Files
wren/test/benchmark/fib.py
Bill Quith 0fa16a20ec Fix deprecated Python timing in benchmark & give more error info. (#844)
- Note: process_time gives CPU time used and perf_counter is absolute time used.
- Looks to have noise of about 1-2%.
2021-01-30 21:40:20 -08:00

12 lines
239 B
Python

from __future__ import print_function
import time
def fib(n):
if n < 2: return n
return fib(n - 1) + fib(n - 2)
start = time.process_time()
for i in range(0, 5):
print(fib(28))
print("elapsed: " + str(time.process_time() - start))