Skip to content

Comments

refactor(formatter): check whether BlockIndent's content is empty in debug mode#16437

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-03-refactor_formatter_check_whether_blockindent_s_content_is_empty_in_debug_mode
Dec 4, 2025
Merged

refactor(formatter): check whether BlockIndent's content is empty in debug mode#16437
graphite-app[bot] merged 1 commit intomainfrom
12-03-refactor_formatter_check_whether_blockindent_s_content_is_empty_in_debug_mode

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Dec 3, 2025

Using snapshot to handle empty content is not ideal because it has a slight overhead. Additionally, it should report immediately that there is empty content rather than silencing it, so that we can improve the code to avoid unnecessary logic.

Copy link
Member Author

Dunqing commented Dec 3, 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.

@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Dec 3, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 3, 2025

CodSpeed Performance Report

Merging #16437 will not alter performance

Comparing 12-03-refactor_formatter_check_whether_blockindent_s_content_is_empty_in_debug_mode (da1502f) with 12-03-refactor_formatter_avoid_formatting_empty_vec_ast (30026b2)

Summary

✅ 38 untouched
⏩ 7 skipped1

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.

Copy link
Member

@leaysgur leaysgur left a comment

Choose a reason for hiding this comment

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

Please let me know if my understanding is wrong:

We can remove snapshot here because empty check is already done before.

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 4, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 4, 2025

Merge activity

…debug mode (#16437)

Using `snapshot` to handle empty content is not ideal because it has a slight overhead. Additionally, it should report immediately that there is empty content rather than silencing it, so that we can improve the code to avoid unnecessary logic.
graphite-app bot pushed a commit that referenced this pull request Dec 4, 2025
…6432)

Prepare for #16437. Early return can avoid unnecessary execution operations

A few percentage performance improvements surprised me.
<img width="1333" height="785" alt="image" src="https://github.com/user-attachments/assets/87f97cac-a9ae-436b-add4-fb9fc4f1b0e4" />
graphite-app bot pushed a commit that referenced this pull request Dec 4, 2025
@graphite-app graphite-app bot force-pushed the 12-03-refactor_formatter_avoid_formatting_empty_vec_ast branch from 30026b2 to 6296b18 Compare December 4, 2025 07:31
@graphite-app graphite-app bot force-pushed the 12-03-refactor_formatter_check_whether_blockindent_s_content_is_empty_in_debug_mode branch from da1502f to 62330df Compare December 4, 2025 07:32
graphite-app bot pushed a commit that referenced this pull request Dec 4, 2025
… content is passed in (#16475)

This is for #16474, similar to #16437, but for `Indent`.
graphite-app bot pushed a commit that referenced this pull request Dec 4, 2025
After #16437, there are no usages of `BufferSnapshot`.
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 4, 2025
Base automatically changed from 12-03-refactor_formatter_avoid_formatting_empty_vec_ast to main December 4, 2025 07:38
@graphite-app graphite-app bot merged commit 62330df into main Dec 4, 2025
21 checks passed
@graphite-app graphite-app bot deleted the 12-03-refactor_formatter_check_whether_blockindent_s_content_is_empty_in_debug_mode branch December 4, 2025 07:38
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…c-project#16432)

Prepare for oxc-project#16437. Early return can avoid unnecessary execution operations

A few percentage performance improvements surprised me.
<img width="1333" height="785" alt="image" src="https://github.com/user-attachments/assets/87f97cac-a9ae-436b-add4-fb9fc4f1b0e4" />
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…debug mode (oxc-project#16437)

Using `snapshot` to handle empty content is not ideal because it has a slight overhead. Additionally, it should report immediately that there is empty content rather than silencing it, so that we can improve the code to avoid unnecessary logic.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants