refactor(transformer): TS transforms only store options they need#6135
Merged
graphite-app[bot] merged 1 commit intoSep 28, 2024
Conversation
Contributor
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
Member
Author
|
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @overlookmotel and the rest of your teammates on |
CodSpeed Performance ReportMerging #6135 will not alter performanceComparing Summary
|
Contributor
Merge activity
|
) All TS transforms only need a subset of the options in `TypeScriptOptions` - mostly just a single `bool`. Store these specific options in the transforms, not the whole `TypeScriptOptions` object. This makes the transformer types smaller, and also checking the option is cheaper as it doesn't involve going through a double-reference. e.g. Accessing `only_remove_type_imports` option with Rust's deref sugar made explicit: Before: `*(&*self.options).only_remove_type_imports` After: `*self.only_remove_type_imports`
88036fb to
30424fa
Compare
Boshen
added a commit
that referenced
this pull request
Sep 29, 2024
## [0.30.5] - 2024-09-29 ### Features - 15552ac napi/transform: Display semantic error (#6160) (Boshen) - f50fdcd napi/transform: Make react refresh option take a boolean (#6146) (Boshen) ### Bug Fixes - f27d59f napi/transform: Remove confusing `jsx` option (#6159) (Boshen) - bfd1988 transformer/react: Should not collect use-hooks if it's a nested member expression (#6143) (Dunqing) ### Refactor - ab187d1 codegen: Restrict visibility of internal methods (#6145) (DonIsaac) - 375bebe transformer: Improve parsing React pragmas (#6138) (overlookmotel) - 0836f6b transformer: Move parsing pragmas into TS transform (#6137) (overlookmotel) - 30424fa transformer: TS transforms only store options they need (#6135) (overlookmotel) --------- Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

All TS transforms only need a subset of the options in
TypeScriptOptions- mostly just a singlebool. Store these specific options in the transforms, not the wholeTypeScriptOptionsobject.This makes the transformer types smaller, and also checking the option is cheaper as it doesn't involve going through a double-reference.
e.g. Accessing
only_remove_type_importsoption with Rust's deref sugar made explicit:Before:
*(&*self.options).only_remove_type_importsAfter:
*self.only_remove_type_imports