Skip to content

perf(oxfmt): Use AllocatorPool to reuse allocator between threads#15412

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-07-perf_oxfmt_use_allocatorpool
Nov 7, 2025
Merged

perf(oxfmt): Use AllocatorPool to reuse allocator between threads#15412
graphite-app[bot] merged 1 commit intomainfrom
11-07-perf_oxfmt_use_allocatorpool

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Nov 7, 2025

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

Copilot AI review requested due to automatic review settings November 7, 2025 05:44
@github-actions github-actions bot added A-cli Area - CLI A-formatter Area - Formatter C-performance Category - Solution not expected to change functional behavior, only performance labels Nov 7, 2025
Copy link
Member Author

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

@leaysgur leaysgur changed the title perf(oxfmt): Use AllocatorPool perf(oxfmt): Use AllocatorPool to reuse allocator between threads Nov 7, 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 implements allocator pooling in oxfmt to improve performance by reusing allocators across parallel formatting tasks, addressing TODO comments that suggested this optimization.

  • Integrated AllocatorPool for 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.

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

Dunqing commented Nov 7, 2025

Merge activity

…15412)

According to my local benchmark for the `outline` repo, it will be slightly better.
@graphite-app graphite-app bot force-pushed the 11-07-perf_oxfmt_use_allocatorpool branch from 18f347d to a6808a0 Compare November 7, 2025 06:16
@graphite-app graphite-app bot merged commit a6808a0 into main Nov 7, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 11-07-perf_oxfmt_use_allocatorpool branch November 7, 2025 06:21
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI 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.

3 participants