File tree 2 files changed +45
-0
lines changed 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const common = require ( '../common' ) ;
4
+ const fs = require ( 'fs' ) ;
5
+
6
+ const bench = common . createBenchmark ( main , {
7
+ n : [ 1e4 ] ,
8
+ kind : [ 'lstat' , 'stat' ]
9
+ } ) ;
10
+
11
+
12
+ function main ( conf ) {
13
+ const n = conf . n >>> 0 ;
14
+ const fn = fs [ conf . kind ] ;
15
+
16
+ bench . start ( ) ;
17
+ ( function r ( cntr ) {
18
+ if ( cntr -- <= 0 )
19
+ return bench . end ( n ) ;
20
+ fn ( __filename , function ( ) {
21
+ r ( cntr ) ;
22
+ } ) ;
23
+ } ( n ) ) ;
24
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const common = require ( '../common' ) ;
4
+ const fs = require ( 'fs' ) ;
5
+
6
+ const bench = common . createBenchmark ( main , {
7
+ n : [ 1e4 ] ,
8
+ kind : [ 'lstatSync' , 'statSync' ]
9
+ } ) ;
10
+
11
+
12
+ function main ( conf ) {
13
+ const n = conf . n >>> 0 ;
14
+ const fn = fs [ conf . kind ] ;
15
+
16
+ bench . start ( ) ;
17
+ for ( var i = 0 ; i < n ; i ++ ) {
18
+ fn ( __filename ) ;
19
+ }
20
+ bench . end ( n ) ;
21
+ }
You can’t perform that action at this time.
0 commit comments