Remove input and length from state#9646
Merged
danez merged 1 commit intobabel:masterfrom Mar 11, 2019
danez:move-input
Merged
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10422/ |
nicolo-ribaudo
approved these changes
Mar 7, 2019
Member
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
I don't know how it works from a memory pow, but "it does never change" is enough for me to remove it from State.
hzoo
approved these changes
Mar 8, 2019
Member
Author
|
I created a memory benchmark and according to it, the memory usage does not change much: |
mAAdhaTTah
added a commit
to mAAdhaTTah/babel
that referenced
this pull request
Mar 15, 2019
* master: (58 commits) Remove dependency on home-or-tmp package (babel#9678) [proposal-object-rest-spread] fix templateLiteral in extractNormalizedKeys (babel#9628) Partial application plugin (babel#9474) Private Static Class Methods (Stage 3) (babel#9446) gulp-uglify@3.0.2 rollup@1.6.0 eslint@5.15.1 jest@24.5.0 regexpu-core@4.5.4 Remove input and length from state (babel#9646) Switch from rollup-stream to rollup and update deps (babel#9640) System modules - Hoist classes like other variables (babel#9639) fix: Don't transpile ES2018 symbol properties (babel#9650) Add WarningsToErrorsPlugin to webpack to avoid missing build problems on CI (babel#9647) Update regexpu-core dependency (babel#9642) Add placeholders support to @babel/types and @babel/generator (babel#9542) Generate plugins file Make babel-standalone an ESModule and enable flow (babel#9025) Reorganize token types and use a map for them (babel#9645) [TS] Allow context type annotation on getters/setters (babel#9641) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #9348 I moved
inputinto thestatebecause it was in bothstateand directly in the parser. I wanted to make things easier and only have it stored once.Looking at it now, this was a bad decision. Why? Because everything in the
stateis variable and changes over time, besidesinput. Even worsestategets cloned in several locations, which means the (potential big) string ininputwill get copied around for no reason. I'm not sure how v8 handles this things, but afaik in javascript assigning primitives to a new variable/property copies the value.This reverses it and moves the input (+ its length) to the parser only.
I couldn't spot a visible performance change with this, but also haven't checked the memory footprint.