MCPcopy Create free account
hub / github.com/covscript/covscript / test_hash_index

Function test_hash_index

tests/benchmark.py:164–173  ·  view source on GitHub ↗
(num_tests, count)

Source from the content-addressed store, hash-verified

162
163# ---------------------- Hash Map Random Access ----------------------
164def test_hash_index(num_tests, count):
165 total_time = 0
166 for _ in range(num_tests):
167 hmap = {f"TAG{t}": random.randint(0, 9999) for t in range(10000)}
168 start_time = runtime_time()
169 s = 0
170 for _ in range(count):
171 s += hmap[f"TAG{random.randint(0, 9999)}"]
172 total_time += runtime_time() - start_time
173 return int(num_tests * count * 1000 / total_time)
174
175
176# ---------------------- Quicksort Benchmark ----------------------

Callers 1

mainFunction · 0.85

Calls 2

rangeFunction · 0.85
runtime_timeFunction · 0.85

Tested by

no test coverage detected