perf(formatter): avoid allocation for SyntaxTokenCowSlice#15366
Merged
graphite-app[bot] merged 1 commit intomainfrom Nov 7, 2025
Merged
Conversation
Member
Author
CodSpeed Performance ReportMerging #15366 will not alter performanceComparing Summary
Footnotes
|
f3f025f to
cf80a9a
Compare
cf80a9a to
7d5e202
Compare
073c27b to
c18f154
Compare
This was referenced Nov 6, 2025
Contributor
Merge activity
|
If it is a `Cow::Borrowed`, then it means the text without changes, so we can use `f.source_text().text_for(&self.span)` to get the original source, which is a `&'a str `, and it can be passed into the `text` without any allocation.
c18f154 to
98c9234
Compare
7d5e202 to
f913543
Compare
graphite-app bot
pushed a commit
that referenced
this pull request
Nov 7, 2025
The last usage has been removed in #15366, and it is no longer useful to us, so remove it. The performance gains from the `FormatElement` enum, as its size has been reduced from `40` to `24`.
Base automatically changed from
11-06-perf_formatter_optimize_formatelement_token_printing
to
main
November 7, 2025 01:33
This was referenced Nov 7, 2025
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.

If it is a
Cow::Borrowed, then it means the text without changes, so we can usef.source_text().text_for(&self.span)to get the original source, which is a&'a str, and it can be passed into thetextwithout any allocation.