perf(formatter): replace String buffer with byte-oriented CodeBuffer#14752
perf(formatter): replace String buffer with byte-oriented CodeBuffer#14752graphite-app[bot] merged 1 commit intomainfrom
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via 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. |
There was a problem hiding this comment.
Pull Request Overview
Refactors the formatter's printer to use byte-oriented CodeBuffer instead of String buffer for significant performance improvements in ASCII-heavy code.
- Replaces
Stringbuffer withCodeBufferfor optimized byte-level operations - Implements ASCII fast-paths for character and string printing
- Uses SIMD-optimized indentation via
CodeBuffer.print_indent()
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/oxc_formatter/src/formatter/printer/mod.rs | Core refactoring replacing String buffer with CodeBuffer, implementing ASCII fast-paths, and optimizing indentation logic |
| crates/oxc_formatter/Cargo.toml | Adds "code_buffer" feature dependency to oxc_data_structures |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
b6de98e to
3995aef
Compare
CodSpeed Performance ReportMerging #14752 will not alter performanceComparing Summary
Footnotes
|
3995aef to
255cc18
Compare
510fc6e to
1992c8c
Compare
c42af69 to
76ae84b
Compare
76ae84b to
e8f05f4
Compare
e8f05f4 to
d5f4e84
Compare
Merge activity
|
…14752) - Use CodeBuffer (Vec<u8>) instead of String for internal buffer - SIMD-optimized indentation via CodeBuffer.print_indent() - Unified byte-level iteration eliminates .chars() iterator overhead - ASCII fast-path (95%+ of JavaScript) handled inline without UTF-8 decoding - Multi-byte UTF-8 decoded on-demand only when needed - Maintains Unicode width calculation correctness 🤖 Generated with [Claude Code](https://claude.com/claude-code)
d5f4e84 to
b92deb4
Compare

🤖 Generated with Claude Code