Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 12, 2021
1 parent d87dabf commit 30789cb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/run/sample/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@ import { sortFloats } from '../../stats/sort.js'
// by it.
// - It is more stable
// - It is faster to compute since we need to sort `sampleMeasures` anyway
// Some durations might be 0:
// - This happens due when the task duration is too close to either:
// - The runner's time resolution (on a given machine)
// - The runner's duration to take a timestamp
// - So durations being 0 are not actually 0 but instead:
// - Unknown durations
// - Lower than any duration not 0
// - Unlike measures being 0, they are not desirable
// - We try to reduce their occurences using the `repeat` loop
// - But they can still occur due to:
// - Wrong `measureCost` estimation
// - Wrong `timeResolution` estimation
// - Task being too slow during calibration, ending calibration too soon
// - As an unknown lowest duration, they are still useful and kept in the
// following cases:
// - `sampleMedian` computation
// - Measures of unit "auto"
// - However, with the unit group "mixed", they do not make sense and are
// filtered out
export const normalizeSampleMeasures = function (sampleMeasures, repeat) {
const sampleMeasuresA = normalizeRepeat(sampleMeasures, repeat)
sortFloats(sampleMeasuresA)
Expand Down

0 comments on commit 30789cb

Please sign in to comment.