@@ -29,14 +29,11 @@ const typescriptSource = fs.readFileSync(
2929// "three" import condition resolves to build/three.module.js
3030const threeEsmPath = fileURLToPath ( import . meta. resolve ( "three" ) ) ;
3131const threeEsmSource = fs . readFileSync ( threeEsmPath , "utf8" ) ;
32- const threeEsmMinSource = fs . readFileSync (
33- threeEsmPath . replace ( / \. j s $ / , ".min.js" ) ,
34- "utf8"
35- ) ;
3632// Popular libraries also shipped as devDependencies.
3733const reactSource = readPkgFile ( "react" , "cjs/react.development.js" ) ;
3834const reactDomSource = readPkgFile ( "react-dom" , "cjs/react-dom.development.js" ) ;
3935const lodashSource = readPkgFile ( "lodash" , "lodash.js" ) ;
36+ const lodashMinSource = readPkgFile ( "lodash" , "lodash.min.js" ) ;
4037const lodashEsSource = readPkgFile ( "lodash-es" , "lodash.js" ) ;
4138
4239// Tokenize-only: drive WebpackParser's owned tokenizer to EOF, no AST/walk.
@@ -92,12 +89,9 @@ export default (bench) => {
9289 new JavascriptParser ( "module" ) . parse ( threeEsmSource , { } ) ;
9390 }
9491 ) ;
95- bench . add (
96- "unit benchmark \"js-parser-unit\", source 'three.module.min.js'" ,
97- ( ) => {
98- new JavascriptParser ( "module" ) . parse ( threeEsmMinSource , { } ) ;
99- }
100- ) ;
92+ bench . add ( "unit benchmark \"js-parser-unit\", source 'lodash.min.js'" , ( ) => {
93+ new JavascriptParser ( "auto" ) . parse ( lodashMinSource , { } ) ;
94+ } ) ;
10195 bench . add (
10296 "unit benchmark \"js-parser-unit\", source 'react.development.js'" ,
10397 ( ) => {
@@ -122,13 +116,10 @@ export default (bench) => {
122116 bench . add ( 'unit benchmark "js-parser-unit", tokenize typescript' , ( ) => {
123117 tokenizeJs ( typescriptSource , "module" ) ;
124118 } ) ;
125- bench . add ( 'unit benchmark "js-parser-unit", tokenize three.module.js' , ( ) => {
126- tokenizeJs ( threeEsmSource , "module" ) ;
119+ bench . add ( 'unit benchmark "js-parser-unit", tokenize lodash.js' , ( ) => {
120+ tokenizeJs ( lodashSource , "script" ) ;
121+ } ) ;
122+ bench . add ( 'unit benchmark "js-parser-unit", tokenize lodash.min.js' , ( ) => {
123+ tokenizeJs ( lodashMinSource , "script" ) ;
127124 } ) ;
128- bench . add (
129- 'unit benchmark "js-parser-unit", tokenize three.module.min.js' ,
130- ( ) => {
131- tokenizeJs ( threeEsmMinSource , "module" ) ;
132- }
133- ) ;
134125} ;
0 commit comments