File tree Expand file tree Collapse file tree 3 files changed +15527
-0
lines changed
Expand file tree Collapse file tree 3 files changed +15527
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const { readFile } = require ( 'node:fs/promises' ) ;
3+ const common = require ( '../common.js' ) ;
4+ const { parse } = require ( 'node:json' ) ;
5+ const path = require ( 'node:path' ) ;
6+
7+ const configs = {
8+ n : [ 1024 ] ,
9+ } ;
10+
11+ const bench = common . createBenchmark ( main , configs ) ;
12+
13+ async function main ( conf ) {
14+ bench . start ( ) ;
15+
16+ const json = await readFile ( path . join ( __dirname , 'twitter.json' ) , 'utf-8' ) ;
17+
18+ for ( let i = 0 ; i < conf . n ; i ++ ) {
19+ parse ( json ) ;
20+ }
21+
22+ bench . end ( conf . n ) ;
23+ }
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const { readFile } = require ( 'node:fs/promises' ) ;
3+ const common = require ( '../common.js' ) ;
4+ const path = require ( 'node:path' ) ;
5+
6+ const configs = {
7+ n : [ 1024 ] ,
8+ } ;
9+
10+ const bench = common . createBenchmark ( main , configs ) ;
11+
12+ async function main ( conf ) {
13+ bench . start ( ) ;
14+
15+ const json = await readFile ( path . join ( __dirname , 'twitter.json' ) , 'utf-8' ) ;
16+
17+ for ( let i = 0 ; i < conf . n ; i ++ ) {
18+ JSON . parse ( json ) ;
19+ }
20+
21+ bench . end ( conf . n ) ;
22+ }
You can’t perform that action at this time.
0 commit comments