mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-10-28 16:18:57 +00:00
scripts: add welch's t test
This commit is contained in:
1 parent
02962d1cab
commit
5a3fc3c92a
1 file changed
+28
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from scipy import stats
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("file", help="JSON file with benchmark results")
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.file) as f:
|
||||
results = json.load(f)["results"]
|
||||
|
||||
a, b = [x["command"] for x in results[:2]]
|
||||
X, Y = [x["times"] for x in results[:2]]
|
||||
|
||||
print("Command 1: {}".format(a))
|
||||
print("Command 2: {}\n".format(b))
|
||||
|
||||
t, p = stats.ttest_ind(X, Y, equal_var=False)
|
||||
th = 0.05
|
||||
dispose = p < th
|
||||
print("t = {}, p = {}".format(t, p))
|
||||
print("p < {} = {}\n".format(th, dispose))
|
||||
if dispose:
|
||||
print("There is a difference between the two benchmarks.")
|
||||
else:
|
||||
print("The two benchmarks are almost the same.")
|
||||
Reference in new issue
Block a user