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:
Bob Nystrom
2013-11-22 16:55:22 +00:00
parent 4a9ea2f0b4
commit 95faef89d5
7 changed files with 112 additions and 7 deletions
+6 -1
View File
@@ -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))