mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Make plotting scripts runnable with uv
This commit is contained in:
1 parent
4a9e066b41
commit
ce49529780
10 files changed
+526
-434
No files matched your search
+35
-29
@@ -16,38 +16,44 @@ from scipy import stats
|
||||
|
||||
from plot_utils import METRICS, add_metric_argument, load_results
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("file", help="JSON file with two benchmark results")
|
||||
add_metric_argument(parser)
|
||||
args = parser.parse_args()
|
||||
|
||||
metric, [results] = load_results(parser, [args.file], args.metric)
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("file", help="JSON file with two benchmark results")
|
||||
add_metric_argument(parser)
|
||||
args = parser.parse_args()
|
||||
|
||||
if len(results) != 2:
|
||||
parser.error("the input file must contain exactly two benchmarks")
|
||||
metric, [results] = load_results(parser, [args.file], args.metric)
|
||||
|
||||
a, b = (x.get("name", x["command"]) for x in results[:2])
|
||||
X, Y = ([m[metric]["value"] for m in x["measurements"]] for x in results[:2])
|
||||
if min(len(X), len(Y)) < 2:
|
||||
parser.error("Welch's t-test requires at least two measurements per benchmark")
|
||||
if len(results) != 2:
|
||||
parser.error("the input file must contain exactly two benchmarks")
|
||||
|
||||
print(f"Metric: {METRICS[metric].label}")
|
||||
print(f"Command 1: {a}")
|
||||
print(f"Command 2: {b}\n")
|
||||
a, b = (x.get("name", x["command"]) for x in results[:2])
|
||||
X, Y = ([m[metric]["value"] for m in x["measurements"]] for x in results[:2])
|
||||
if min(len(X), len(Y)) < 2:
|
||||
parser.error("Welch's t-test requires at least two measurements per benchmark")
|
||||
|
||||
t, p = stats.ttest_ind(X, Y, equal_var=False)
|
||||
if not math.isfinite(p):
|
||||
parser.error("Welch's t-test is undefined for these measurements")
|
||||
th = 0.05
|
||||
dispose = p < th
|
||||
print(f"t = {t:.3}, p = {p:.3}")
|
||||
print()
|
||||
print(f"Metric: {METRICS[metric].label}")
|
||||
print(f"Command 1: {a}")
|
||||
print(f"Command 2: {b}\n")
|
||||
|
||||
if dispose:
|
||||
print(
|
||||
f"A statistically significant difference in mean value was detected (p < {th})."
|
||||
)
|
||||
else:
|
||||
print(
|
||||
f"No statistically significant difference in mean value was detected (p >= {th})."
|
||||
)
|
||||
t, p = stats.ttest_ind(X, Y, equal_var=False)
|
||||
if not math.isfinite(p):
|
||||
parser.error("Welch's t-test is undefined for these measurements")
|
||||
th = 0.05
|
||||
dispose = p < th
|
||||
print(f"t = {t:.3}, p = {p:.3}")
|
||||
print()
|
||||
|
||||
if dispose:
|
||||
print(
|
||||
f"A statistically significant difference in mean value was detected (p < {th})."
|
||||
)
|
||||
else:
|
||||
print(
|
||||
f"No statistically significant difference in mean value was detected (p >= {th})."
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user