perf(packages/codegen): remove redundant branch - #25885
Merged
graphite-app[bot] merged 1 commit intoAug 18, 2026
Merged
graphite-app[bot] merged 1 commit into
graphite-app[bot] merged 1 commit into
Conversation
This was referenced Aug 18, 2026
perf(packages/codegen): remove redundant setting of
last in printImportAttributes and printIf
#25882
Merged
Merged
Member
Author
This was referenced Aug 18, 2026
overlookmotel
marked this pull request as ready for review
August 18, 2026 16:18
Contributor
There was a problem hiding this comment.
Pull request overview
This PR applies a small optimization in the JS codegen sourcemap generator by removing a redundant sourceText !== undefined branch in the “non-empty mappings” return path, relying on the existing early-return narrowing (if (sourceText === undefined || mappingCount === 0) ...) to guarantee sourceText is defined afterward.
Changes:
- Simplifies the final
SourceMapconstruction by returning the object literal directly. - Always includes
sourcesContent: [sourceText]in the main (mapping-producing) return path, leveraging prior control-flow narrowing.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
camc314
approved these changes
Aug 18, 2026
overlookmotel
force-pushed
the
om/08-18-perf_packages_sourcemap_make_location_passed_to_recordsourcemapping_always_a_number
branch
from
August 18, 2026 17:00
b704dd4 to
e521387
Compare
overlookmotel
force-pushed
the
om/08-18-perf_packages_codegen_remove_redundant_branch
branch
from
August 18, 2026 17:00
afda1f2 to
0f55d76
Compare
camc314
approved these changes
Aug 18, 2026
Contributor
Merge activity
|
graphite-app
Bot
changed the base branch from
om/08-18-perf_packages_sourcemap_make_location_passed_to_recordsourcemapping_always_a_number
to
graphite-base/25885
August 18, 2026 17:17
Follow-on after #25585. Small optimization. The function exits early if `sourceText === undefined`, so no need to check this again later.
graphite-app
Bot
force-pushed
the
om/08-18-perf_packages_codegen_remove_redundant_branch
branch
from
August 18, 2026 17:25
0f55d76 to
b6b14c0
Compare
graphite-app
Bot
deleted the
om/08-18-perf_packages_codegen_remove_redundant_branch
branch
August 18, 2026 17:30
graphite-app Bot
pushed a commit
that referenced
this pull request
Aug 19, 2026
### 🚀 Features - 83cb516 minifier: Improve negation of expressions in boolean context (#25755) (Armano) ### 🐛 Bug Fixes - 134fb22 isolated-declarations: Preserve unresolved parameter types (#25909) (Dunqing) - 526c2b3 codegen: Remove deprecated test APIs (#25889) (camc314) - 344a9b2 codegen: Align enum template sourcemaps (#25872) (camc314) ### ⚡ Performance - 5ef0c93 minifier: Unwrap all unary exprs without creating dummy expressions (#25891) (Armano) - 8783524 packages/codegen: Remove loop from `growMappingBuffer` (#25886) (overlookmotel) - b6b14c0 packages/codegen: Remove redundant branch (#25885) (overlookmotel) - be6adf0 packages/sourcemap: Make `location` passed to `recordSourceMapping` always a number (#25884) (overlookmotel) - f720f15 packages/codegen: Take named-mapping only code off hot path in `recordSourceMapping` (#25883) (overlookmotel) - a734af5 packages/codegen: Remove redundant setting of `last` in `printImportAttributes` and `printIf` (#25882) (overlookmotel) - c6e44c6 packages/codegen: Combine 2 writes in `printJSXElement` (#25881) (overlookmotel) - 8801662 packages/codegen: Remove redundant mapping from `printParams` (#25880) (overlookmotel) ### 📚 Documentation - 5ad330e packages/codegen: Reformat comments (#25876) (overlookmotel)
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.

Follow-on after #25585. Small optimization.
The function exits early if
sourceText === undefined, so no need to check this again later.