refactor(allocator): combine Arena::new_chunk_memory_details into Arena::new_chunk#21795
Conversation
There was a problem hiding this comment.
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
NewChunkMemoryDetailsand folded its computation intoArena::new_chunk. - Updated call sites (
try_with_min_align_and_capacity, slow allocation path) to call the unifiednew_chunkdirectly. - Updated comments/tests to reference
Arena::new_chunkas 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. |
Merging this PR will not alter performance
Comparing Footnotes
|
b56ad4b to
0423be8
Compare
e689974 to
75bb873
Compare
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.
75bb873 to
5e7dbac
Compare
0423be8 to
481b75f
Compare

Refactor of
Arena.Arena::new_chunk_memory_detailsandArena::new_chunkare always called together. Combine them into a single function. This makes the call sites shorter and clearer.