Skip to content

Comments

ci(benchmarks/formatter): Update formatter bench with sort-imports#15584

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-11-ci_benchmarks_formatter_add_formatter_bench_with_sort-imports
Nov 11, 2025
Merged

ci(benchmarks/formatter): Update formatter bench with sort-imports#15584
graphite-app[bot] merged 1 commit intomainfrom
11-11-ci_benchmarks_formatter_add_formatter_bench_with_sort-imports

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Nov 11, 2025

I think we don't need to add another benchmark for the sort import feature; enabling it in > formatter.rs is enough. Any of the current benchmark files contains many import statements.

It seems there was no need to create a separate file after all.

My intention was to confirm that the benchmark for the formatter alone consistently produced better results than the benchmark with sorting enabled.

To verify this, shouldn't the benchmarks be separated?

Copy link
Member Author

leaysgur commented Nov 11, 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.

Base automatically changed from 11-11-feat_oxfmt_print_nothing_for_default_write_mode to main November 11, 2025 06:44
@leaysgur
Copy link
Member Author

@Dunqing ↑ Does that make sense?

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 11, 2025

CodSpeed Performance Report

Merging #15584 will degrade performances by 20.95%

Comparing 11-11-ci_benchmarks_formatter_add_formatter_bench_with_sort-imports (92843a7) with main (128e186)1

Summary

❌ 4 regressions
✅ 33 untouched

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Mode Benchmark BASE HEAD Change
Simulation formatter[RadixUIAdoptionSection.jsx] 479.7 µs 508.3 µs -5.61%
Simulation formatter[binder.ts] 17.2 ms 20.9 ms -17.68%
Simulation formatter[cal.com.tsx] 155.4 ms 185.8 ms -16.34%
Simulation formatter[react.development.js] 8.3 ms 10.5 ms -20.95%

Footnotes

  1. No successful run was found on main (99823ad) during the generation of this report, so 128e186 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Dunqing
Copy link
Member

Dunqing commented Nov 11, 2025

No, the formatter alone is faster than enabling the sorting feature, no doubt. We don't have any reason to care about this.

The purpose of turning on the sorting import feature in the Formatter benchmark is to help us catch any performance regressions early. For example, you made some improvements to the sorting import feature recently, but we don't have any way to verify whether your changes have improved or regressed the performance. Sometimes, we made improvements that we thought should make it significantly faster, but it is actually slower than before. This will avoid introducing incorrect optimization.

Additionally, adding more benchmarks will increase the CI time, which causes us to wait longer for CI to complete. It is not worth adding this for a single one of the features of the formatter.

@leaysgur leaysgur force-pushed the 11-11-ci_benchmarks_formatter_add_formatter_bench_with_sort-imports branch from 166eaa6 to 92843a7 Compare November 11, 2025 08:10
Copilot AI review requested due to automatic review settings November 11, 2025 08:10
@leaysgur
Copy link
Member Author

Thanks! Alright, let's just enable sorting on the existing benchmarks.

@leaysgur leaysgur changed the title ci(benchmarks/formatter): Add formatter bench with sort-imports ci(benchmarks/formatter): Update formatter bench with sort-imports Nov 11, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the formatter benchmark to enable the experimental sort-imports feature, aiming to measure the performance impact of this feature. However, the current implementation replaces the baseline benchmark rather than adding a separate comparison benchmark.

Key Changes:

  • Added SortImports import to the formatter benchmark
  • Modified FormatOptions to enable experimental_sort_imports with default settings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Dunqing
Copy link
Member

Dunqing commented Nov 11, 2025

Wow, the sorting import feature takes 15% to 20% of the time in large files.

@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Nov 11, 2025
Copy link
Member

Dunqing commented Nov 11, 2025

Merge activity

…15584)

> I think we don't need to add another benchmark for the sort import feature; enabling it in > formatter.rs is enough. Any of the current benchmark files contains many import statements.

It seems there was no need to create a separate file after all.

My intention was to confirm that the benchmark for the formatter alone consistently produced better results than the benchmark with sorting enabled.

To verify this, shouldn't the benchmarks be separated?
@graphite-app graphite-app bot force-pushed the 11-11-ci_benchmarks_formatter_add_formatter_bench_with_sort-imports branch from 92843a7 to 65764fd Compare November 11, 2025 08:39
@graphite-app graphite-app bot merged commit 65764fd into main Nov 11, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 11-11-ci_benchmarks_formatter_add_formatter_bench_with_sort-imports branch November 11, 2025 08:47
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 11, 2025
@leaysgur leaysgur mentioned this pull request Nov 12, 2025
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants