Skip to content

Commit 325cb00

Browse files
committed
refactor: replace hardcoded outlier factor for improved readability
1 parent 4c42d15 commit 325cb00

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/pytest_codspeed/instruments/walltime.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
TIMER_RESOLUTION_NS = get_clock_info("perf_counter").resolution * 1e9
2727
DEFAULT_MIN_ROUND_TIME_NS = TIMER_RESOLUTION_NS * 1_000_000
2828

29+
IQR_OUTLIER_FACTOR = 1.5
30+
2931

3032
@dataclass
3133
class BenchmarkConfig:
@@ -89,7 +91,10 @@ def from_list(
8991
)
9092
iqr_ns = q3_ns - q1_ns
9193
iqr_outlier_rounds = sum(
92-
1 for t in times_ns if t < q1_ns - 1.5 * iqr_ns or t > q3_ns + 1.5 * iqr_ns
94+
1
95+
for t in times_ns
96+
if t < q1_ns - IQR_OUTLIER_FACTOR * iqr_ns
97+
or t > q3_ns + IQR_OUTLIER_FACTOR * iqr_ns
9398
)
9499
stdev_outlier_rounds = sum(
95100
1

0 commit comments

Comments
 (0)