@@ -4,24 +4,24 @@ const child_process = require('child_process');
44const http_benchmarkers = require ( './_http-benchmarkers.js' ) ;
55
66class Benchmark {
7- // Used to make sure a benchmark only start a timer once
8- #started = false ;
7+ constructor ( fn , configs , options = { } ) {
8+ // Used to make sure a benchmark only start a timer once
9+ this . _started = false ;
910
10- // Indicate that the benchmark ended
11- #ended = false ;
11+ // Indicate that the benchmark ended
12+ this . _ended = false ;
1213
13- // Holds process.hrtime value
14- #time = [ 0 , 0 ] ;
14+ // Holds process.hrtime value
15+ this . _time = [ 0 , 0 ] ;
1516
16- // Use the file name as the name of the benchmark
17- name = require . main . filename . slice ( __dirname . length + 1 ) ;
17+ // Use the file name as the name of the benchmark
18+ this . name = require . main . filename . slice ( __dirname . length + 1 ) ;
1819
19- // Execution arguments i.e. flags used to run the jobs
20- flags = process . env . NODE_BENCHMARK_FLAGS ?
21- process . env . NODE_BENCHMARK_FLAGS . split ( / \s + / ) :
22- [ ] ;
20+ // Execution arguments i.e. flags used to run the jobs
21+ this . flags = process . env . NODE_BENCHMARK_FLAGS ?
22+ process . env . NODE_BENCHMARK_FLAGS . split ( / \s + / ) :
23+ [ ] ;
2324
24- constructor ( fn , configs , options = { } ) {
2525 // Parse job-specific configuration from the command line arguments
2626 const argv = process . argv . slice ( 2 ) ;
2727 const parsed_args = this . _parseArgs ( argv , configs , options ) ;
@@ -214,21 +214,21 @@ class Benchmark {
214214 }
215215
216216 start ( ) {
217- if ( this . #started ) {
217+ if ( this . _started ) {
218218 throw new Error ( 'Called start more than once in a single benchmark' ) ;
219219 }
220- this . #started = true ;
221- this . #time = process . hrtime ( ) ;
220+ this . _started = true ;
221+ this . _time = process . hrtime ( ) ;
222222 }
223223
224224 end ( operations ) {
225225 // Get elapsed time now and do error checking later for accuracy.
226- const elapsed = process . hrtime ( this . #time ) ;
226+ const elapsed = process . hrtime ( this . _time ) ;
227227
228- if ( ! this . #started ) {
228+ if ( ! this . _started ) {
229229 throw new Error ( 'called end without start' ) ;
230230 }
231- if ( this . #ended ) {
231+ if ( this . _ended ) {
232232 throw new Error ( 'called end multiple times' ) ;
233233 }
234234 if ( typeof operations !== 'number' ) {
@@ -244,7 +244,7 @@ class Benchmark {
244244 elapsed [ 1 ] = 1 ;
245245 }
246246
247- this . #ended = true ;
247+ this . _ended = true ;
248248 const time = elapsed [ 0 ] + elapsed [ 1 ] / 1e9 ;
249249 const rate = operations / time ;
250250 this . report ( rate , elapsed ) ;
0 commit comments