Skip to content

perf(formatter): reduce clone overhead in JSDoc formatting#20136

Closed
Dunqing wants to merge 2 commits intofeat/jsdoc-comment-formattingfrom
perf/jsdoc-reduce-clone-overhead
Closed

perf(formatter): reduce clone overhead in JSDoc formatting#20136
Dunqing wants to merge 2 commits intofeat/jsdoc-comment-formattingfrom
perf/jsdoc-reduce-clone-overhead

Conversation

@Dunqing
Copy link
Copy Markdown
Member

@Dunqing Dunqing commented Mar 9, 2026

Avoid cloning Vec-containing FormatOptions fields (sort_imports,
sort_tailwindcss, jsdoc) when creating type/embedded format options.
Uses struct update syntax with None overrides instead of full clone,
which eliminates heap allocations for the Vec fields that are
irrelevant to JSDoc type formatting and embedded code formatting.

Also skips import tag processing when no @import tags exist (common
case), and defers merged_desc String allocation until needed.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Avoid cloning Vec-containing FormatOptions fields (sort_imports,
sort_tailwindcss, jsdoc) when creating type/embedded format options.
Uses struct update syntax with None overrides instead of full clone,
which eliminates heap allocations for the Vec fields that are
irrelevant to JSDoc type formatting and embedded code formatting.

Also skips import tag processing when no @import tags exist (common
case), and defers merged_desc String allocation until needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member Author

Dunqing commented Mar 9, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-formatter Area - Formatter C-performance Category - Solution not expected to change functional behavior, only performance labels Mar 9, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 9, 2026

Merging this PR will not alter performance

✅ 49 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing perf/jsdoc-reduce-clone-overhead (bc7117c) with feat/jsdoc-comment-formatting (82290a9)

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Dunqing Dunqing closed this Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant