perf(oxfmt): Use AllocatorPool to reuse allocator between threads#15412
perf(oxfmt): Use AllocatorPool to reuse allocator between threads#15412graphite-app[bot] merged 1 commit intomainfrom
AllocatorPool to reuse allocator between threads#15412Conversation
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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
AllocatorPool to reuse allocator between threads
There was a problem hiding this comment.
Pull Request Overview
This PR implements allocator pooling in oxfmt to improve performance by reusing allocators across parallel formatting tasks, addressing TODO comments that suggested this optimization.
- Integrated
AllocatorPoolfor efficient allocator reuse across threads - Enabled the "pool" feature in oxc_allocator dependency
- Refactored thread count calculation to be captured once and reused in output formatting
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/oxfmt/src/service.rs | Added AllocatorPool field to FormatService and updated constructor to accept it; replaced direct Allocator::new() calls with pooled allocators |
| apps/oxfmt/src/format.rs | Created allocator pool based on thread count before spawning the formatting service; captured num_of_threads for consistent use in statistics output |
| apps/oxfmt/Cargo.toml | Enabled "pool" feature for oxc_allocator dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
…15412) According to my local benchmark for the `outline` repo, it will be slightly better.
18f347d to
a6808a0
Compare

According to my local benchmark for the
outlinerepo, it will be slightly better.