Skip to content

Comments

perf(formatter): memorize text width for FormatElement::Text#15372

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-06-perf_formatter_memoize_text_width_for_formatelemetn_text
Nov 7, 2025
Merged

perf(formatter): memorize text width for FormatElement::Text#15372
graphite-app[bot] merged 1 commit intomainfrom
11-06-perf_formatter_memoize_text_width_for_formatelemetn_text

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Nov 6, 2025

Back port from astral-sh/ruff#6552

Copy link
Member Author

Dunqing commented Nov 6, 2025


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 hot fixes, skip the queue and merge this PR next

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.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 6, 2025

CodSpeed Performance Report

Merging #15372 will improve performances by 10.12%

Comparing 11-06-perf_formatter_memoize_text_width_for_formatelemetn_text (2b15086) with 11-06-feat_formatter_remove_tag_startverbatim_and_tag_endverbatim (35201d9)

Summary

⚡ 4 improvements
✅ 29 untouched
⏩ 4 skipped1

Benchmarks breakdown

Mode Benchmark BASE HEAD Change
Simulation formatter[RadixUIAdoptionSection.jsx] 520.1 µs 502.1 µs +3.59%
Simulation formatter[binder.ts] 22.2 ms 20.1 ms +10.12%
Simulation formatter[cal.com.tsx] 181.2 ms 169.9 ms +6.63%
Simulation formatter[react.development.js] 10.7 ms 9.9 ms +8.52%

Footnotes

  1. 4 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 changed the title perf(formatter): memoize text width for FormatElemetn::Text perf(formatter): memoize text width for FormatElement::Text Nov 6, 2025
@Dunqing Dunqing changed the title perf(formatter): memoize text width for FormatElement::Text perf(formatter): memorize text width for FormatElement::Text Nov 6, 2025
@Dunqing Dunqing force-pushed the 11-06-perf_formatter_memoize_text_width_for_formatelemetn_text branch from 92465a1 to 2b15086 Compare November 6, 2025 16:02
@Dunqing Dunqing marked this pull request as ready for review November 7, 2025 01:05
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Nov 7, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 7, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 11-06-feat_formatter_remove_tag_startverbatim_and_tag_endverbatim branch from 35201d9 to 2dfc3bd Compare November 7, 2025 01:21
@graphite-app graphite-app bot force-pushed the 11-06-perf_formatter_memoize_text_width_for_formatelemetn_text branch from 2b15086 to 8f25a0e Compare November 7, 2025 01:21
@graphite-app graphite-app bot added 0-merge Merge with Graphite Merge Queue and removed 0-merge Merge with Graphite Merge Queue labels Nov 7, 2025
Base automatically changed from 11-06-feat_formatter_remove_tag_startverbatim_and_tag_endverbatim to main November 7, 2025 01:58
@graphite-app graphite-app bot merged commit 8f25a0e into main Nov 7, 2025
21 checks passed
@graphite-app graphite-app bot deleted the 11-06-perf_formatter_memoize_text_width_for_formatelemetn_text branch November 7, 2025 02:00
graphite-app bot pushed a commit that referenced this pull request Nov 7, 2025
graphite-app bot pushed a commit that referenced this pull request Nov 17, 2025
…15762)

Regressed by #15372. The changes are made to match previous behavior. In `fits_text`, once the text width is multiple lines, we should check whether the current line width plus the width of the text to the first line break is greater than the allowed line width to take action, but previously, we didn't include `plus the width of the text to the first line break`.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…xc-project#15762)

Regressed by oxc-project#15372. The changes are made to match previous behavior. In `fits_text`, once the text width is multiple lines, we should check whether the current line width plus the width of the text to the first line break is greater than the allowed line width to take action, but previously, we didn't include `plus the width of the text to the first line break`.
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