feat: add benchmark runner with fib implementations and OS.clock primitive
Add a benchmark runner script (benchmark/run_all) that executes multiple fibonacci implementations across languages (Lua, Python, Ruby, Wren) and computes mean, median, and standard deviation from 7 runs. Update existing fib benchmarks to loop 5 times at fib(30) with elapsed timing. Introduce OS.clock primitive in C core and OS class to support timing in Wren. Adjust number formatting to "%.14g" for consistent output precision.
This commit is contained in:
+6
-1
@@ -1,5 +1,10 @@
|
||||
import time
|
||||
|
||||
def fib(n):
|
||||
if n < 2: return n
|
||||
return fib(n - 1) + fib(n - 2)
|
||||
|
||||
print fib(35)
|
||||
start = time.clock()
|
||||
for i in range(0, 5):
|
||||
print(fib(30))
|
||||
print("elapsed: " + str(time.clock() - start))
|
||||
Reference in New Issue
Block a user