Skip to content

Commit 151c09c

Browse files
author
rodrigo.nogueira
committed
Fix logic bugs in benchmarks: correct cache miss counting and concurrent loop
1 parent b4e713b commit 151c09c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

benchmark.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ def test_cache_miss_benchmark(
136136
run_loop: Callable[..., Any],
137137
func: _LRUCacheWrapper[Any],
138138
) -> None:
139-
unique_objects = [object() for _ in range(128)]
139+
# Use 2048 objects (16x maxsize=128) to force evictions and measure actual misses
140+
unique_objects = [object() for _ in range(2048)]
140141
func.cache_clear()
141142

142143
async def run() -> None:
@@ -222,7 +223,7 @@ def test_concurrent_cache_hit_benchmark(
222223
async def gather_coros():
223224
gather = asyncio.gather
224225
for _ in range(10):
225-
return await gather(*map(func, keys))
226+
await gather(*map(func, keys))
226227

227228
benchmark(run_loop, gather_coros)
228229

0 commit comments

Comments
 (0)