Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
squash: change the order of the benchmarks every iteration
  • Loading branch information
not-an-aardvark committed Aug 28, 2016
commit 0c2077c1496cfb41a328137d072944aab8e623d4
16 changes: 10 additions & 6 deletions test/sequential/test-crypto-timing-safe-equal.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ function getTValue(compareFunc) {
const rawUnequalBenches = Array(numTrials);

for (let i = 0; i < numTrials; i++) {
// FIXME: The order of these benchmarks is swapped.
// Flip them back before merging.

// Second benchmark: comparing two unequal buffers
rawUnequalBenches[i] = runBenchmark(compareFunc, bufferB, bufferC, false);
// First benchmark: comparing two equal buffers
rawEqualBenches[i] = runBenchmark(compareFunc, bufferA1, bufferA2, true);
if (i % 2) {
// First benchmark: comparing two equal buffers
rawEqualBenches[i] = runBenchmark(compareFunc, bufferA1, bufferA2, true);
// Second benchmark: comparing two unequal buffers
rawUnequalBenches[i] = runBenchmark(compareFunc, bufferB, bufferC, false);
} else {
// Flip the order of the benchmarks every other iteration
rawUnequalBenches[i] = runBenchmark(compareFunc, bufferB, bufferC, false);
rawEqualBenches[i] = runBenchmark(compareFunc, bufferA1, bufferA2, true);
}
}

const equalBenches = filterOutliers(rawEqualBenches);
Expand Down