mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Added measure time script that can receive a bash command as an argument and measure the amount of time required to run a script
This commit is contained in:
parent
a93dc3f2a2
commit
ce4066f1a3
2 changed files with 31 additions and 0 deletions
29
bench/measure_time.py
Normal file
29
bench/measure_time.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import os, sys, time
|
||||
try:
|
||||
import numpy as np
|
||||
from scipy import mean, stats
|
||||
except ModuleNotFoundError:
|
||||
print("Warning: scipy package is not installed, confidence values will not be available")
|
||||
stats = None
|
||||
|
||||
duration_list = []
|
||||
|
||||
for i in range(1,10):
|
||||
start = time.perf_counter()
|
||||
|
||||
print(sys.argv[1])
|
||||
|
||||
os.system(sys.argv[1])
|
||||
|
||||
end = time.perf_counter()
|
||||
|
||||
duration_ms = (end - start) * 1000
|
||||
|
||||
duration_list.append(duration_ms)
|
||||
|
||||
|
||||
# Stats
|
||||
mean = np.mean(duration_list)
|
||||
std_err = stats.sem(duration_list)
|
||||
|
||||
print("SUCCESS: {} : {:.2f}ms +/- {:.2f}% on luau ".format('duration', mean,std_err))
|
2
bench/test.py
Normal file
2
bench/test.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
import time
|
||||
time.sleep(1)
|
Loading…
Add table
Reference in a new issue