@@ -29,11 +29,16 @@ 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+ fileURLToPath (
34+ new URL ( "../../js/benchmark/three.module.min.js" , import . meta. url )
35+ ) ,
36+ "utf8"
37+ ) ;
3238// Popular libraries also shipped as devDependencies.
3339const reactSource = readPkgFile ( "react" , "cjs/react.development.js" ) ;
3440const reactDomSource = readPkgFile ( "react-dom" , "cjs/react-dom.development.js" ) ;
3541const lodashSource = readPkgFile ( "lodash" , "lodash.js" ) ;
36- const lodashMinSource = readPkgFile ( "lodash" , "lodash.min.js" ) ;
3742const lodashEsSource = readPkgFile ( "lodash-es" , "lodash.js" ) ;
3843
3944// Tokenize-only: drive WebpackParser's owned tokenizer to EOF, no AST/walk.
@@ -89,9 +94,12 @@ export default (bench) => {
8994 new JavascriptParser ( "module" ) . parse ( threeEsmSource , { } ) ;
9095 }
9196 ) ;
92- bench . add ( "unit benchmark \"js-parser-unit\", source 'lodash.min.js'" , ( ) => {
93- new JavascriptParser ( "auto" ) . parse ( lodashMinSource , { } ) ;
94- } ) ;
97+ bench . add (
98+ "unit benchmark \"js-parser-unit\", source 'three.module.min.js'" ,
99+ ( ) => {
100+ new JavascriptParser ( "module" ) . parse ( threeEsmMinSource , { } ) ;
101+ }
102+ ) ;
95103 bench . add (
96104 "unit benchmark \"js-parser-unit\", source 'react.development.js'" ,
97105 ( ) => {
@@ -116,10 +124,13 @@ export default (bench) => {
116124 bench . add ( 'unit benchmark "js-parser-unit", tokenize typescript' , ( ) => {
117125 tokenizeJs ( typescriptSource , "module" ) ;
118126 } ) ;
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" ) ;
127+ bench . add ( 'unit benchmark "js-parser-unit", tokenize three.module.js' , ( ) => {
128+ tokenizeJs ( threeEsmSource , "module" ) ;
124129 } ) ;
130+ bench . add (
131+ 'unit benchmark "js-parser-unit", tokenize three.module.min.js' ,
132+ ( ) => {
133+ tokenizeJs ( threeEsmMinSource , "module" ) ;
134+ }
135+ ) ;
125136} ;
0 commit comments