Skip to content

Commit 0af65c5

Browse files
committed
Introduce Warm-up Phase for Dudect Measurement
A warm-up step was added to the measurement function to discard the first batch of data, inspired by a privately implemented earlier version that passed tests for queue-related functions. This follows the approach described in the Dudect paper, which skips initial measurements to improve timing stability., potentially mitigating factors like cache misses or allocation delays. Unlike the author's GitHub implementation, which dynamically checks the percentiles array state for each call, a static boolean is used here to mark the first execution within a single test run, as this suits the fixed iteration structure of the testing loop. Tests using queue insertion and removal functions showed no notable difference in constant-time behavior with or without this step after memory leaks were fixed, but it is retained for potential improvements in t-test precision under different test conditions. Change-Id: Ieec138264fdd8d087142cdf3c3e9f961f521e80b
1 parent 599de0f commit 0af65c5

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

dudect/fixture.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,20 @@ static bool doit(int mode)
196196
bool ret = measure(before_ticks, after_ticks, input_data, mode);
197197
differentiate(exec_times, before_ticks, after_ticks);
198198
prepare_percentiles(exec_times, percentiles);
199-
update_statistics(exec_times, classes, percentiles);
200-
ret &= report();
199+
200+
/* This warm-up step discards the first measurement batch by skipping
201+
* its statistical analysis. A static boolean flag controls this by
202+
* marking the initial execution, ensuring only the first call within
203+
* a test run is excluded from the t-test computation.
204+
*/
205+
static bool first_time = true;
206+
if (first_time) {
207+
first_time = false;
208+
ret = true;
209+
} else {
210+
update_statistics(exec_times, classes, percentiles);
211+
ret &= report();
212+
}
201213

202214
free(before_ticks);
203215
free(after_ticks);

0 commit comments

Comments
 (0)