Skip to content

refactor(allocator): remove pointless Option in Arena::new_chunk_memory_details#21746

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

refactor(allocator): remove pointless Option in Arena::new_chunk_memory_details#21746
graphite-app[bot] merged 1 commit intomainfrom
om/04-25-refactor_allocator_remove_pointless_option_in_arena_new_chunk_memory_details_

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 25, 2026

Refactor. Arena::new_chunk_memory_details was taking an Option<usize> as param, but all callers passed it Some. Remove the pointless Option wrapper.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 25, 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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 25, 2026

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/04-25-refactor_allocator_remove_pointless_option_in_arena_new_chunk_memory_details_ (7f7df2b) with om/04-25-perf_allocator_remove_check_in_arena_new_chunk_memory_details_ (0f4d918)2

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.

  2. No successful run was found on om/04-25-perf_allocator_remove_check_in_arena_new_chunk_memory_details_ (a5c562f) during the generation of this report, so fd50608 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel self-assigned this Apr 25, 2026
@overlookmotel overlookmotel added A-allocator Area - Allocator C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Apr 25, 2026
@overlookmotel overlookmotel marked this pull request as ready for review April 25, 2026 13:41
Copilot AI review requested due to automatic review settings April 25, 2026 13:42
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 Arena::new_chunk_memory_details to take a usize instead of an Option<usize>, since all in-tree callers always provided Some(...).

Changes:

  • Updated Arena::new_chunk_memory_details signature from Option<usize> to usize and simplified internal handling.
  • Updated callers in arena creation and slow-path allocation to pass a plain usize.
  • Replaced a checked_add overflow check with direct addition when computing final chunk size.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_allocator/src/arena/create.rs Updates new_chunk_memory_details signature/logic and adjusts initial chunk allocation path.
crates/oxc_allocator/src/arena/alloc_impl.rs Updates slow-path allocation code to call the new usize-based API.

Comment thread crates/oxc_allocator/src/arena/create.rs Outdated
@overlookmotel overlookmotel changed the base branch from om/04-25-fix_allocator_fix_arithmetic_overflow_in_arena_new_chunk_memory_details_ to graphite-base/21746 April 25, 2026 14:00
@overlookmotel overlookmotel force-pushed the om/04-25-refactor_allocator_remove_pointless_option_in_arena_new_chunk_memory_details_ branch from 2b2a93a to 1a1387a Compare April 25, 2026 14:00
@overlookmotel overlookmotel changed the base branch from graphite-base/21746 to om/04-25-perf_allocator_remove_check_in_arena_new_chunk_memory_details_ April 25, 2026 14:00
@overlookmotel overlookmotel force-pushed the om/04-25-perf_allocator_remove_check_in_arena_new_chunk_memory_details_ branch from b91d01a to 5f66c03 Compare April 25, 2026 15:48
@overlookmotel overlookmotel force-pushed the om/04-25-refactor_allocator_remove_pointless_option_in_arena_new_chunk_memory_details_ branch 2 times, most recently from 6453ad5 to dfeb5e2 Compare April 26, 2026 11:45
@overlookmotel overlookmotel force-pushed the om/04-25-perf_allocator_remove_check_in_arena_new_chunk_memory_details_ branch from 5f66c03 to 0f4d918 Compare April 26, 2026 11:45
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented Apr 26, 2026

Merge activity

…emory_details` (#21746)

Refactor. `Arena::new_chunk_memory_details` was taking an `Option<usize>` as param, but all callers passed it `Some`. Remove the pointless `Option` wrapper.
@graphite-app graphite-app Bot force-pushed the om/04-25-perf_allocator_remove_check_in_arena_new_chunk_memory_details_ branch from 0f4d918 to a5c562f Compare April 26, 2026 21:46
@graphite-app graphite-app Bot force-pushed the om/04-25-refactor_allocator_remove_pointless_option_in_arena_new_chunk_memory_details_ branch from dfeb5e2 to 7f7df2b Compare April 26, 2026 21:46
Base automatically changed from om/04-25-perf_allocator_remove_check_in_arena_new_chunk_memory_details_ to main April 26, 2026 21:58
@graphite-app graphite-app Bot merged commit 7f7df2b into main Apr 26, 2026
38 checks passed
@graphite-app graphite-app Bot deleted the om/04-25-refactor_allocator_remove_pointless_option_in_arena_new_chunk_memory_details_ branch April 26, 2026 21:59
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