Skip to content

Commit baf9e4f

Browse files
benchmark: replace failing on context switching with warning (#3625)
1 parent 7532a5c commit baf9e4f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

resources/benchmark.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,12 @@ function collectSamples(modulePath: string) {
122122

123123
if (sample.involuntaryContextSwitches > 0) {
124124
numOfConsequentlyRejectedSamples++;
125-
if (numOfConsequentlyRejectedSamples > 5) {
126-
throw Error(
127-
'Can not sample benchmark due to 5 consequent runs beings rejected because of context switching',
125+
if (numOfConsequentlyRejectedSamples === 5) {
126+
console.error(
127+
yellow(
128+
' Five or more consequent runs beings rejected because of context switching.\n' +
129+
' Measurement can take a significantly longer time and its correctness can also be impacted.',
130+
),
128131
);
129132
}
130133
continue;

0 commit comments

Comments
 (0)