Skip to content

Commit 28c3979

Browse files
committed
Stabilize fast path scaling test on Windows
1 parent 4985cb4 commit 28c3979

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/layer4/fast_path_optimization_test.exs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,11 @@ defmodule JsonRemedy.Layer4.FastPathOptimizationTest do
279279
# Verify roughly linear scaling (later times shouldn't be exponentially larger)
280280
[time1, time2, time3] = times
281281

282-
# Time should scale roughly linearly (allowing for some variance)
283-
ratio_1_to_2 = time2 / max(time1, 1)
284-
ratio_2_to_3 = time3 / max(time2, 1)
282+
# Add a baseline to smooth out high-resolution timer noise on fast paths (e.g. Windows CI)
283+
baseline = 5_000
284+
285+
ratio_1_to_2 = (time2 + baseline) / (time1 + baseline)
286+
ratio_2_to_3 = (time3 + baseline) / (time2 + baseline)
285287

286288
# Ratios should be reasonable (not exponential growth)
287289
assert ratio_1_to_2 < 10

0 commit comments

Comments
 (0)