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

Function test_string_ops

tests/benchmark.py:137–147  ·  view source on GitHub ↗
(num_tests, length)

Source from the content-addressed store, hash-verified

135
136
137def test_string_ops(num_tests, length):
138 total_ops = 0
139 pool = [rand_bytes(length) for _ in range(100)] # pre-generated pool
140 for _ in range(num_tests):
141 counter = 0
142 start_time = runtime_time()
143 while runtime_time() - start_time < 1000:
144 s = pool[random.randint(0, 99)] + pool[random.randint(0, 99)]
145 counter += 1
146 total_ops += counter
147 return int(total_ops / num_tests)
148
149
150# ---------------------- Array Random Access ----------------------

Callers 1

mainFunction · 0.85

Calls 3

rand_bytesFunction · 0.85
rangeFunction · 0.85
runtime_timeFunction · 0.85

Tested by

no test coverage detected