New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: Improve @babel/generator
performance
#16061
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/55717/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
|
||
this._indentChar = format.indent.style.charCodeAt(0); | ||
this._indentRepeat = format.indent.style.length; | ||
|
||
this._inputMap = map?._inputMap; | ||
|
||
this._buf = new Buffer(map, this._indentChar); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we already pass String.fromCharCode(this._indentChar)
here, so that then we don't have to convert it multiple times inside Buffer
?
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome.
Time consumption reduced by ~15%