File tree 3 files changed +42
-0
lines changed
3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const common = require ( '../common.js' ) ;
4
+
5
+ const bench = common . createBenchmark ( main , {
6
+ n : [ 1e7 ] ,
7
+ } ) ;
8
+
9
+ function main ( { n } ) {
10
+ bench . start ( ) ;
11
+ for ( let i = 0 ; i < n ; ++ i )
12
+ new Error ( 'test' ) ;
13
+ bench . end ( n ) ;
14
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const common = require ( '../common' ) ;
4
+
5
+ const bench = common . createBenchmark ( main , {
6
+ n : [ 1e7 ] ,
7
+ } , {
8
+ flags : [ '--expose-internals' ]
9
+ } ) ;
10
+
11
+ function main ( { n } ) {
12
+ const {
13
+ codes : {
14
+ ERR_INVALID_STATE ,
15
+ }
16
+ } = require ( 'internal/errors' ) ;
17
+ bench . start ( ) ;
18
+ for ( let i = 0 ; i < n ; ++ i )
19
+ new ERR_INVALID_STATE . TypeError ( 'test' ) ;
20
+ bench . end ( n ) ;
21
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ require ( '../common' ) ;
4
+
5
+ const runBenchmark = require ( '../common/benchmark' ) ;
6
+
7
+ runBenchmark ( 'error' , { NODEJS_BENCHMARK_ZERO_ALLOWED : 1 } ) ;
You can’t perform that action at this time.
0 commit comments