@@ -15,35 +15,6 @@ if (['default', 'csv', 'silent'].indexOf(outputFormat) == -1) {
15
15
16
16
exports . PORT = process . env . PORT || 12346 ;
17
17
18
- // If this is the main module, then run the benchmarks
19
- if ( module === require . main ) {
20
- var type = process . argv [ 2 ] ;
21
- var testFilter = process . argv [ 3 ] ;
22
- if ( ! type ) {
23
- console . error ( 'usage:\n ./node benchmark/common.js <type> [testFilter]' ) ;
24
- process . exit ( 1 ) ;
25
- }
26
-
27
- var dir = path . join ( __dirname , type ) ;
28
- var tests = fs . readdirSync ( dir ) ;
29
-
30
- if ( testFilter ) {
31
- var filteredTests = tests . filter ( function ( item ) {
32
- if ( item . lastIndexOf ( testFilter ) >= 0 ) {
33
- return item ;
34
- }
35
- } ) ;
36
-
37
- if ( filteredTests . length === 0 ) {
38
- console . error ( '%s is not found in \n %j' , testFilter , tests ) ;
39
- return ;
40
- }
41
- tests = filteredTests ;
42
- }
43
-
44
- runBenchmarks ( ) ;
45
- }
46
-
47
18
function hasWrk ( ) {
48
19
var result = child_process . spawnSync ( 'wrk' , [ '-h' ] ) ;
49
20
if ( result . error && result . error . code === 'ENOENT' ) {
@@ -53,31 +24,6 @@ function hasWrk() {
53
24
}
54
25
}
55
26
56
- function runBenchmarks ( ) {
57
- var test = tests . shift ( ) ;
58
- if ( ! test )
59
- return ;
60
-
61
- if ( test . match ( / ^ [ \. _ ] / ) )
62
- return process . nextTick ( runBenchmarks ) ;
63
-
64
- if ( outputFormat == 'default' )
65
- console . error ( type + '/' + test ) ;
66
-
67
- test = path . resolve ( dir , test ) ;
68
-
69
- var a = ( process . execArgv || [ ] ) . concat ( test ) ;
70
- var child = child_process . spawn ( process . execPath , a , { stdio : 'inherit' } ) ;
71
- child . on ( 'close' , function ( code ) {
72
- if ( code ) {
73
- process . exit ( code ) ;
74
- } else {
75
- console . log ( '' ) ;
76
- runBenchmarks ( ) ;
77
- }
78
- } ) ;
79
- }
80
-
81
27
exports . createBenchmark = function ( fn , options ) {
82
28
return new Benchmark ( fn , options ) ;
83
29
} ;
@@ -262,4 +208,3 @@ exports.v8ForceOptimization = function(method, ...args) {
262
208
method . apply ( null , args ) ;
263
209
return eval ( '%GetOptimizationStatus(method)' ) ;
264
210
} ;
265
-
0 commit comments