Skip to content

Commit 5fcf423

Browse files
committed
repair benchmark
1 parent 3b40faf commit 5fcf423

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

benchmark/util/is-native-error.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ function main({ argument, version, n }) {
2525
const types = require('internal/util/types');
2626

2727
const func = { native: util, js: types }[version].isNativeError;
28-
const arg = args[argument];
28+
29+
const testArgs = [args[argument], args[argument], args[argument]];
30+
let sum = 0;
2931

3032
bench.start();
3133
for (let iteration = 0; iteration < n; iteration++) {
32-
func(arg);
34+
const testArg = testArgs[iteration % 3];
35+
sum += func(testArg) ? 1 : 0;
3336
}
3437
bench.end(n);
38+
if (sum < 0) console.log(sum);
3539
}

0 commit comments

Comments
 (0)