pytest-codspeed 3.0.0b3__tar.gz → 3.0.0b4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/PKG-INFO +1 -1
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/__init__.py +2 -2
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/instruments/walltime.py +21 -12
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/plugin.py +3 -5
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/.gitignore +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/LICENSE +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/README.md +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/pyproject.toml +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/instruments/__init__.py +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/instruments/valgrind/__init__.py +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/instruments/valgrind/_wrapper/.gitignore +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/instruments/valgrind/_wrapper/__init__.py +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/instruments/valgrind/_wrapper/wrapper.c +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/instruments/valgrind/_wrapper/wrapper.h +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/instruments/valgrind/_wrapper/wrapper.pyi +0 -0
- {pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/utils.py +0 -0
{pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/instruments/walltime.py
RENAMED
|
@@ -7,6 +7,7 @@ from time import get_clock_info, perf_counter_ns
|
|
|
7
7
|
from typing import TYPE_CHECKING
|
|
8
8
|
|
|
9
9
|
from rich.console import Console
|
|
10
|
+
from rich.markup import escape
|
|
10
11
|
from rich.table import Table
|
|
11
12
|
from rich.text import Text
|
|
12
13
|
|
|
@@ -54,15 +55,14 @@ class BenchmarkStats:
|
|
|
54
55
|
mean_ns: float
|
|
55
56
|
stdev_ns: float
|
|
56
57
|
|
|
57
|
-
lower_fence_ns: float
|
|
58
58
|
q1_ns: float
|
|
59
59
|
median_ns: float
|
|
60
60
|
q3_ns: float
|
|
61
|
-
upper_fence_ns: float
|
|
62
61
|
|
|
63
62
|
rounds: int
|
|
64
63
|
total_time: float
|
|
65
|
-
|
|
64
|
+
iqr_outlier_rounds: int
|
|
65
|
+
stdev_outlier_rounds: int
|
|
66
66
|
iter_per_round: int
|
|
67
67
|
warmup_iters: int
|
|
68
68
|
|
|
@@ -78,12 +78,22 @@ class BenchmarkStats:
|
|
|
78
78
|
) -> BenchmarkStats:
|
|
79
79
|
stdev_ns = stdev(times_ns) if len(times_ns) > 1 else 0
|
|
80
80
|
mean_ns = mean(times_ns)
|
|
81
|
-
|
|
81
|
+
if len(times_ns) > 1:
|
|
82
|
+
q1_ns, median_ns, q3_ns = quantiles(times_ns, n=4)
|
|
83
|
+
else:
|
|
84
|
+
q1_ns, median_ns, q3_ns = (
|
|
85
|
+
mean_ns,
|
|
86
|
+
mean_ns,
|
|
87
|
+
mean_ns,
|
|
88
|
+
)
|
|
82
89
|
iqr_ns = q3_ns - q1_ns
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
iqr_outlier_rounds = sum(
|
|
91
|
+
1 for t in times_ns if t < q1_ns - 1.5 * iqr_ns or t > q3_ns + 1.5 * iqr_ns
|
|
92
|
+
)
|
|
93
|
+
stdev_outlier_rounds = sum(
|
|
94
|
+
1
|
|
95
|
+
for t in times_ns
|
|
96
|
+
if t < mean_ns - 3 * stdev_ns or t > mean_ns + 3 * stdev_ns
|
|
87
97
|
)
|
|
88
98
|
|
|
89
99
|
return cls(
|
|
@@ -91,14 +101,13 @@ class BenchmarkStats:
|
|
|
91
101
|
max_ns=max(times_ns),
|
|
92
102
|
stdev_ns=stdev_ns,
|
|
93
103
|
mean_ns=mean_ns,
|
|
94
|
-
lower_fence_ns=lower_fence_ns,
|
|
95
104
|
q1_ns=q1_ns,
|
|
96
105
|
median_ns=median_ns,
|
|
97
106
|
q3_ns=q3_ns,
|
|
98
|
-
upper_fence_ns=upper_fence_ns,
|
|
99
107
|
rounds=rounds,
|
|
100
108
|
total_time=total_time,
|
|
101
|
-
|
|
109
|
+
iqr_outlier_rounds=iqr_outlier_rounds,
|
|
110
|
+
stdev_outlier_rounds=stdev_outlier_rounds,
|
|
102
111
|
iter_per_round=iter_per_round,
|
|
103
112
|
warmup_iters=warmup_iters,
|
|
104
113
|
)
|
|
@@ -235,7 +244,7 @@ class WallTimeInstrument(Instrument):
|
|
|
235
244
|
if rsd > 0.1:
|
|
236
245
|
rsd_text.stylize("red bold")
|
|
237
246
|
table.add_row(
|
|
238
|
-
bench.name,
|
|
247
|
+
escape(bench.name),
|
|
239
248
|
f"{bench.stats.min_ns/bench.stats.iter_per_round:,.0f}ns",
|
|
240
249
|
rsd_text,
|
|
241
250
|
f"{bench.stats.total_time:,.2f}s",
|
|
@@ -261,17 +261,15 @@ def _measure(
|
|
|
261
261
|
) -> T:
|
|
262
262
|
is_gc_enabled = gc.isenabled()
|
|
263
263
|
if is_gc_enabled:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
# gc.disable()
|
|
264
|
+
gc.collect()
|
|
265
|
+
gc.disable()
|
|
267
266
|
try:
|
|
268
267
|
uri, name = get_git_relative_uri_and_name(nodeid, config.rootpath)
|
|
269
268
|
return plugin.instrument.measure(name, uri, fn, *args, **kwargs)
|
|
270
269
|
finally:
|
|
271
270
|
# Ensure GC is re-enabled even if the test failed
|
|
272
271
|
if is_gc_enabled:
|
|
273
|
-
|
|
274
|
-
# gc.enable()
|
|
272
|
+
gc.enable()
|
|
275
273
|
|
|
276
274
|
|
|
277
275
|
def wrap_runtest(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_codspeed-3.0.0b3 → pytest_codspeed-3.0.0b4}/src/pytest_codspeed/instruments/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|