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

Function test_array_index

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

Source from the content-addressed store, hash-verified

149
150# ---------------------- Array Random Access ----------------------
151def test_array_index(num_tests, count):
152 total_time = 0
153 for _ in range(num_tests):
154 arr = [random.randint(0, 9999) for _ in range(10000)]
155 start_time = runtime_time()
156 s = 0
157 for _ in range(count):
158 s += arr[random.randint(0, 9999)]
159 total_time += runtime_time() - start_time
160 return int(num_tests * count * 1000 / total_time)
161
162
163# ---------------------- Hash Map Random Access ----------------------

Callers 1

mainFunction · 0.85

Calls 2

rangeFunction · 0.85
runtime_timeFunction · 0.85

Tested by

no test coverage detected