File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -12,18 +12,24 @@ const bench = common.createBenchmark(
1212 main ,
1313 {
1414 argument : [ 'true' ] ,
15- version : [ 'instanceof' , 'isError '] ,
15+ version : [ 'native ' ] ,
1616 n : [ 1e6 ] ,
1717 } ,
18+ {
19+ flags : [ '--expose-internals' , '--no-warnings' ] ,
20+ } ,
1821) ;
1922
2023function main ( { argument, version, n } ) {
24+ const util = common . binding ( 'util' ) ;
25+ const types = require ( 'internal/util/types' ) ;
26+
27+ const func = { native : util , js : types } [ version ] . isNativeError ;
2128 const arg = args [ argument ] ;
22- const func = version === 'isError' ? Error . isError : ( v ) => v instanceof Error ;
2329
2430 bench . start ( ) ;
2531 let result ;
26- for ( let i = 0 ; i < n ; i ++ ) {
32+ for ( let iteration = 0 ; iteration < n ; iteration ++ ) {
2733 result = func ( arg ) ;
2834 }
2935 bench . end ( n ) ;
You can’t perform that action at this time.
0 commit comments