Skip to content

Commit a51c643

Browse files
committed
Introduce Warm-up Phase for Dudect Measurement
Inspired by 'Reparaz et al.'s' 2016 paper, this change adds a warm-up phase to the function that collects and processes measurement batches, skipping the first batch to reduce timing variance in queue operations like insert and remove. Unlike the author's implementation, which uses dynamic percentile checks, this approach uses a static boolean to mark the initial run, suiting the fixed test loop. Experiments in simulation mode with qtest.c and perf show a minor 1.5% reduction in standard deviation (from 449ms to 442ms), suggesting a small improvement in execution stability. Reference: 'Reparaz et al.', "Dude, is my code constant time?", 2016, https://eprint.iacr.org/2016/1123.pdf Change-Id: I71692702401c130cd7cac1d424209308baecb87b
1 parent 599de0f commit a51c643

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

dudect/fixture.c

+14-2
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)