Skip to content

Commit

Permalink
Add benchmarks for query strings with int values (#1257)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Oct 13, 2024
1 parent ef4b498 commit 642b5e2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_url_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
REL_URL = URL("/req")
QUERY_SEQ = {str(i): tuple(str(j) for j in range(10)) for i in range(10)}
SIMPLE_QUERY = {str(i): str(i) for i in range(10)}
SIMPLE_INT_QUERY = {str(i): i for i in range(10)}


def test_url_build_with_host_and_port(benchmark: BenchmarkFixture) -> None:
Expand Down Expand Up @@ -179,6 +180,13 @@ def _run() -> None:
BASE_URL.with_query(SIMPLE_QUERY)


def test_url_make_with_int_query_mapping(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
for _ in range(25):
BASE_URL.with_query(SIMPLE_INT_QUERY)


def test_url_make_with_query_sequence_mapping(benchmark: BenchmarkFixture) -> None:
@benchmark
def _run() -> None:
Expand Down

0 comments on commit 642b5e2

Please sign in to comment.