You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: avoid garbage colection in token type utils (#18)
* perf: avoid garbage colection in token type utils
This changes the token type functions such that they no longer create a
new array of token types every time, but instead use normal equality
checks and `includes` on a pre-computed set.
`acorn` token types can be mutated, but we already take a snapshot of
the types at time of creating our `AcornTypeScript`. Due to this, we can
just store the `Object.values` one time up front and call `includes` on
the same array later.
All of this means we no longer cause garbage collection (for creating a
single-use array) and we save CPU cycles on calling `includes` against
sets if we already matched.
* chore: add changeset
* Update .changeset/nine-carrots-share.md
---------
Co-authored-by: Ben McCann <[email protected]>
Co-authored-by: Simon H <[email protected]>
0 commit comments