Skip to content

perf(scope_hoisting): remove alloc field from ScopeHoistingFinalizer#10425

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/07-23-perf_scope_hoisting_remove_alloc_field_from_scopehoistingfinalizer_
Jul 24, 2026
Merged

perf(scope_hoisting): remove alloc field from ScopeHoistingFinalizer#10425
graphite-app[bot] merged 1 commit into
mainfrom
om/07-23-perf_scope_hoisting_remove_alloc_field_from_scopehoistingfinalizer_

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Continuation of #10424.

ScopeHoistingFinalizer has these fields:

pub struct ScopeHoistingFinalizer<'me, 'ast: 'me> {
  pub alloc: &'ast Allocator,
  pub ast_builder: AstBuilder<'ast>,
  // ... other fields ...
}

AstBuilder<'ast> already contains an &'ast Allocator, so this was duplicating the same reference twice.

#10424 removed most usages of alloc field as a by-product of shortening code. This PR removes the remaining usage, and removes the alloc field itself.

overlookmotel commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

How to use the Graphite Merge Queue

Add the label graphite: merge-when-ready to this PR to add it to 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.

@overlookmotel
overlookmotel marked this pull request as ready for review July 23, 2026 23:45
Copilot AI review requested due to automatic review settings July 23, 2026 23:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 continues the ScopeHoistingFinalizer cleanup from #10424 by removing the redundant alloc: &Allocator field and routing all remaining allocations through the existing AstBuilder<'ast> (and the GetAllocator trait), avoiding duplicated allocator references in the finalizer state.

Changes:

  • Removed the alloc field from ScopeHoistingFinalizer and its construction site.
  • Replaced remaining self.alloc uses with self.allocator() / self.ast_builder.allocator()-backed calls.
  • Updated visitor code to use GetAllocator for allocator access where needed.

Reviewed changes

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

File Description
crates/rolldown/src/module_finalizers/mod.rs Drops the alloc field and migrates allocations/clones/into_in calls to self.allocator() (backed by ast_builder).
crates/rolldown/src/module_finalizers/impl_visit_mut.rs Imports GetAllocator and switches JSX member expression conversions to use self.allocator().
crates/rolldown/src/module_finalizers/finalizer_context.rs Updates ScopeHoistingFinalizer initialization to no longer set alloc, relying on AstBuilder::new(alloc) only.

@codspeed-hq

codspeed-hq Bot commented Jul 23, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 7 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing om/07-23-perf_scope_hoisting_remove_alloc_field_from_scopehoistingfinalizer_ (75a6bb4) with om/07-23-refactor_implement_getastbuilder_on_visitor_pass_types (6802e7c)

Open in CodSpeed

Footnotes

  1. 10 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/07-23-refactor_implement_getastbuilder_on_visitor_pass_types branch from 0b48133 to 6802e7c Compare July 24, 2026 00:02
@overlookmotel
overlookmotel force-pushed the om/07-23-perf_scope_hoisting_remove_alloc_field_from_scopehoistingfinalizer_ branch 2 times, most recently from 82ebb1d to 75a6bb4 Compare July 24, 2026 00:18

@hyfdev hyfdev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

— Review by @hyfdev, assisted by GPT-5

hyfdev commented Jul 24, 2026

Copy link
Copy Markdown
Member

Merge activity

  • Jul 24, 3:38 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jul 24, 3:38 AM UTC: hyfdev added this pull request to the Graphite merge queue.
  • Jul 24, 3:59 AM UTC: Merged by the Graphite merge queue.

…er` (#10425)

Continuation of #10424.

`ScopeHoistingFinalizer` has these fields:

```rust
pub struct ScopeHoistingFinalizer<'me, 'ast: 'me> {
  pub alloc: &'ast Allocator,
  pub ast_builder: AstBuilder<'ast>,
  // ... other fields ...
}
```

`AstBuilder<'ast>` already contains an `&'ast Allocator`, so this was duplicating the same reference twice.

#10424 removed most usages of `alloc` field as a by-product of shortening code. This PR removes the remaining usage, and removes the `alloc` field itself.
@graphite-app
graphite-app Bot force-pushed the om/07-23-refactor_implement_getastbuilder_on_visitor_pass_types branch from 6802e7c to 8d87835 Compare July 24, 2026 03:47
@graphite-app
graphite-app Bot force-pushed the om/07-23-perf_scope_hoisting_remove_alloc_field_from_scopehoistingfinalizer_ branch from 75a6bb4 to df12b36 Compare July 24, 2026 03:47
Base automatically changed from om/07-23-refactor_implement_getastbuilder_on_visitor_pass_types to main July 24, 2026 03:58
@graphite-app
graphite-app Bot merged commit df12b36 into main Jul 24, 2026
37 checks passed
@graphite-app
graphite-app Bot deleted the om/07-23-perf_scope_hoisting_remove_alloc_field_from_scopehoistingfinalizer_ branch July 24, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants