Skip to content

Commit 20515ba

Browse files
authored
Add benchmarks for creating multidict from dict (#1104)
1 parent f6b4db1 commit 20515ba

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_multidict_benchmarks.py

+20
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,26 @@ def test_create_cimultidict_with_items_istr(
449449
def _run() -> None:
450450
case_insensitive_multidict_class(items)
451451

452+
def test_create_multidict_with_dict(
453+
benchmark: BenchmarkFixture, any_multidict_class: Type[MultiDict[str]]
454+
) -> None:
455+
dct = {str(i): str(i) for i in range(100)}
456+
457+
@benchmark
458+
def _run() -> None:
459+
any_multidict_class(dct)
460+
461+
462+
def test_create_cimultidict_with_dict_istr(
463+
benchmark: BenchmarkFixture,
464+
case_insensitive_multidict_class: Type[CIMultiDict[istr]],
465+
) -> None:
466+
dct = {istr(i): istr(i) for i in range(100)}
467+
468+
@benchmark
469+
def _run() -> None:
470+
case_insensitive_multidict_class(dct)
471+
452472

453473
def test_create_multidict_with_items_with_kwargs(
454474
benchmark: BenchmarkFixture, any_multidict_class: Type[MultiDict[str]]

0 commit comments

Comments
 (0)