Skip to content

perf(formatter): don't call sort_tailwind_classes if no classes need to be sorted#17698

Merged
graphite-app[bot] merged 1 commit intomainfrom
01-06-perf_formatter_don_t_call_sort_tailwind_classes_if_no_classes_need_to_be_sorted
Jan 6, 2026
Merged

perf(formatter): don't call sort_tailwind_classes if no classes need to be sorted#17698
graphite-app[bot] merged 1 commit intomainfrom
01-06-perf_formatter_don_t_call_sort_tailwind_classes_if_no_classes_need_to_be_sorted

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Jan 6, 2026

If the classes are empty, that means no classes need to be sorted. Then return the original one to avoid calling the JS side, which is quite a costly function.

After this, the formatting time went from 8s to 2s in the outline repo locally.

@github-actions github-actions bot added A-formatter Area - Formatter C-performance Category - Solution not expected to change functional behavior, only performance labels Jan 6, 2026
Copy link
Member Author

Dunqing commented Jan 6, 2026


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 Jan 6, 2026

CodSpeed Performance Report

Merging #17698 will not alter performance

Comparing 01-06-perf_formatter_don_t_call_sort_tailwind_classes_if_no_classes_need_to_be_sorted (5919086) with 01-06-refactor_formatter_remove_unnecessary_clone_for_formatcontext_and_all_its_fields (edce2c8)1

Summary

✅ 38 untouched
⏩ 7 skipped2

Footnotes

  1. No successful run was found on 01-06-refactor_formatter_remove_unnecessary_clone_for_formatcontext_and_all_its_fields (207d327) during the generation of this report, so 8a26e3b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 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 marked this pull request as ready for review January 6, 2026 07:58
@Dunqing Dunqing requested a review from leaysgur January 6, 2026 08:00
@Dunqing Dunqing force-pushed the 01-06-refactor_formatter_remove_unnecessary_clone_for_formatcontext_and_all_its_fields branch from edce2c8 to 207d327 Compare January 6, 2026 08:09
@Dunqing Dunqing force-pushed the 01-06-perf_formatter_don_t_call_sort_tailwind_classes_if_no_classes_need_to_be_sorted branch from 85d7bd7 to 5919086 Compare January 6, 2026 08:09
@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label Jan 6, 2026
Copy link
Member

leaysgur commented Jan 6, 2026

Merge activity

@leaysgur
Copy link
Member

leaysgur commented Jan 6, 2026

from 8s to 2s

😆

…d to be sorted (#17698)

If the classes are empty, that means no classes need to be sorted. Then return the original one to avoid calling the JS side, which is quite a costly function.

After this, the formatting time went from `8s` to `2s` in the `outline` repo locally.
@graphite-app graphite-app bot force-pushed the 01-06-refactor_formatter_remove_unnecessary_clone_for_formatcontext_and_all_its_fields branch from 207d327 to 1aa7591 Compare January 6, 2026 08:34
@graphite-app graphite-app bot force-pushed the 01-06-perf_formatter_don_t_call_sort_tailwind_classes_if_no_classes_need_to_be_sorted branch from 5919086 to c6a99fd Compare January 6, 2026 08:35
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 6, 2026
Base automatically changed from 01-06-refactor_formatter_remove_unnecessary_clone_for_formatcontext_and_all_its_fields to main January 6, 2026 08:41
@graphite-app graphite-app bot merged commit c6a99fd into main Jan 6, 2026
21 checks passed
@graphite-app graphite-app bot deleted the 01-06-perf_formatter_don_t_call_sort_tailwind_classes_if_no_classes_need_to_be_sorted branch January 6, 2026 08:42
Dunqing added a commit that referenced this pull request Jan 6, 2026
# Oxlint

# Oxfmt
### 🚀 Features

- a19cc93 oxfmt: Add debug logging to oxfmt LSP to troubleshoot resolved
options at runtime (#17695) (Nicholas Rayburn)

### 🐛 Bug Fixes

- 3b4aced formatter: Should not treat multi-type arguments of
TSTypeReference as a complex type (#17708) (Dunqing)
- dcfdd41 formatter: Should not set up tailwindcss callback when no
tailwindcss configuration is set (#17696) (Dunqing)
- 6f65901 formatter: Return original classes when there are no
tailwindcss classes sort callback (#17689) (Dunqing)

### ⚡ Performance

- c6a99fd formatter: Don't call `sort_tailwind_classes` if no classes
need to be sorted (#17698) (Dunqing)

Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
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.

2 participants