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

Function test_sequential_fcall

tests/benchmark.py:31–44  ·  view source on GitHub ↗

Benchmark function call overhead in tight loops

(num_tests)

Source from the content-addressed store, hash-verified

29
30# ---------------------- Function Call Performance ----------------------
31def test_sequential_fcall(num_tests):
32 """Benchmark function call overhead in tight loops"""
33 total_ops = 0
34
35 def increment(counter):
36 return counter + 1
37
38 for _ in range(num_tests):
39 counter = 0
40 start_time = runtime_time()
41 while runtime_time() - start_time < 1000:
42 counter = increment(counter)
43 total_ops += counter
44 return int(total_ops / num_tests)
45
46
47# ---------------------- Recursion Performance ----------------------

Callers 1

mainFunction · 0.85

Calls 3

rangeFunction · 0.85
runtime_timeFunction · 0.85
incrementFunction · 0.85

Tested by

no test coverage detected