Skip to content

refactor(allocator): combine Arena::new_chunk_memory_details into Arena::new_chunk#21795

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/04-26-refactor_allocator_combine_arena_new_chunk_memory_details_into_arena_new_chunk_
Apr 26, 2026
Merged

refactor(allocator): combine Arena::new_chunk_memory_details into Arena::new_chunk#21795
graphite-app[bot] merged 1 commit intomainfrom
om/04-26-refactor_allocator_combine_arena_new_chunk_memory_details_into_arena_new_chunk_

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 26, 2026

Refactor of Arena.

Arena::new_chunk_memory_details and Arena::new_chunk are always called together. Combine them into a single function. This makes the call sites shorter and clearer.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 26, 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 changes, fast-track this PR to the front of 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.

Copy link
Copy Markdown
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

Refactors the allocator’s chunk-allocation path by merging the “compute new chunk sizing” step into the actual Arena::new_chunk allocation routine, reducing indirection at call sites while keeping the same sizing logic.

Changes:

  • Removed NewChunkMemoryDetails and folded its computation into Arena::new_chunk.
  • Updated call sites (try_with_min_align_and_capacity, slow allocation path) to call the unified new_chunk directly.
  • Updated comments/tests to reference Arena::new_chunk as the source of the chunk-sizing formula.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
crates/oxc_allocator/src/arena/tests.rs Updates test commentary to point at the unified Arena::new_chunk sizing logic.
crates/oxc_allocator/src/arena/create.rs Removes NewChunkMemoryDetails and merges sizing + allocation into new_chunk; updates constructor to call the unified API.
crates/oxc_allocator/src/arena/alloc_impl.rs Simplifies the slow-path growth loop to call unified new_chunk directly.

Comment thread crates/oxc_allocator/src/arena/create.rs Outdated
Comment thread crates/oxc_allocator/src/arena/tests.rs
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 26, 2026

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/04-26-refactor_allocator_combine_arena_new_chunk_memory_details_into_arena_new_chunk_ (481b75f) with om/04-26-refactor_allocator_improve_safety_of_dealloc_chunk_list_ (5e7dbac)

Open in CodSpeed

Footnotes

  1. 3 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.

@overlookmotel overlookmotel force-pushed the om/04-26-refactor_allocator_combine_arena_new_chunk_memory_details_into_arena_new_chunk_ branch from b56ad4b to 0423be8 Compare April 26, 2026 21:15
@overlookmotel overlookmotel force-pushed the om/04-26-refactor_allocator_improve_safety_of_dealloc_chunk_list_ branch from e689974 to 75bb873 Compare April 26, 2026 21:15
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented Apr 26, 2026

Merge activity

…Arena::new_chunk` (#21795)

Refactor of `Arena`.

`Arena::new_chunk_memory_details` and `Arena::new_chunk` are always called together. Combine them into a single function. This makes the call sites shorter and clearer.
@graphite-app graphite-app Bot force-pushed the om/04-26-refactor_allocator_improve_safety_of_dealloc_chunk_list_ branch from 75bb873 to 5e7dbac Compare April 26, 2026 21:53
@graphite-app graphite-app Bot requested a review from camc314 as a code owner April 26, 2026 21:53
@graphite-app graphite-app Bot force-pushed the om/04-26-refactor_allocator_combine_arena_new_chunk_memory_details_into_arena_new_chunk_ branch from 0423be8 to 481b75f Compare April 26, 2026 21:53
Base automatically changed from om/04-26-refactor_allocator_improve_safety_of_dealloc_chunk_list_ to main April 26, 2026 22:10
@graphite-app graphite-app Bot merged commit 481b75f into main Apr 26, 2026
38 checks passed
@graphite-app graphite-app Bot deleted the om/04-26-refactor_allocator_combine_arena_new_chunk_memory_details_into_arena_new_chunk_ branch April 26, 2026 22:13
@overlookmotel overlookmotel added A-allocator Area - Allocator C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-allocator Area - Allocator 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