improve builder performance in @babel/types#13369
improve builder performance in @babel/types#13369zxbodya wants to merge 3 commits intobabel:mainfrom
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/46419/ |
| .map(([k, v]) => ` ${k}: ${v},`) | ||
| .join( | ||
| "\n" | ||
| )} } as t.${type};\n validateNode(node);\n return node;\n}\n`; |
There was a problem hiding this comment.
thinking if this validateNode(…) call can be removed…
There was a problem hiding this comment.
I think we have customized validation that can only be invoked via validateNode.
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit ea26c67:
|
JLHwung
left a comment
There was a problem hiding this comment.
On the performance benchmark, we have micro benchmark cases in babel-parser: packages/babel-parser/benchmark
| .map(([k, v]) => ` ${k}: ${v},`) | ||
| .join( | ||
| "\n" | ||
| )} } as t.${type};\n validateNode(node);\n return node;\n}\n`; |
There was a problem hiding this comment.
I think we have customized validation that can only be invoked via validateNode.
| ) { | ||
| const node = { | ||
| type: "CatchClause", | ||
| param: param === undefined ? null : param, |
There was a problem hiding this comment.
Can we replace # === undefined ? a : b by default parameters, if it is one of the builder keys.
There was a problem hiding this comment.
yeah, actually just tried that - let me push it
yeah, seen it… - however that would be useful only after already using babel/types in parser curios also what would be impact of the change on existing plugins already using it -- it there already some benchmark on something like typical "es6" to "es5" codebase? |
|
The benchmark is for general purpose. For example I have drafted a benchmark on the string literal builder: JLHwung@44e6253 The new implementation is 40% faster. |
This is experimental try to improve node builders in @babel/types. Feedback and suggestions are welcome.
Goals:
Todo: