Skip to content

Commit 37b6c55

Browse files
author
Cameron McHenry
committed
refactor(mangler): use bump allocator for internal storage
1 parent 723308b commit 37b6c55

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

crates/oxc_mangler/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ impl<'t> Mangler<'t> {
307307

308308
// Stores the lived scope ids for each slot. Keyed by slot number.
309309
let mut slot_liveness: std::vec::Vec<FixedBitSet> = vec![];
310-
let mut tmp_bindings = std::vec::Vec::with_capacity(100);
310+
let mut tmp_bindings = Vec::with_capacity_in(100, self.temp_allocator.as_ref());
311311

312-
let mut reusable_slots = std::vec::Vec::new();
312+
let mut reusable_slots = Vec::new_in(self.temp_allocator.as_ref());
313313
// Walk down the scope tree and assign a slot number for each symbol.
314314
// It is possible to do this in a loop over the symbol list,
315315
// but walking down the scope tree seems to generate a better code.
@@ -428,8 +428,10 @@ impl<'t> Mangler<'t> {
428428
// function fa() { .. } function ga() { .. }
429429

430430
let mut freq_iter = frequencies.iter();
431-
let mut symbols_renamed_in_this_batch = std::vec::Vec::with_capacity(100);
432-
let mut slice_of_same_len_strings = std::vec::Vec::with_capacity(100);
431+
let mut symbols_renamed_in_this_batch =
432+
Vec::with_capacity_in(100, self.temp_allocator.as_ref());
433+
let mut slice_of_same_len_strings =
434+
Vec::with_capacity_in(100, self.temp_allocator.as_ref());
433435
// 2. "N number of vars are going to be assigned names of the same length"
434436
for (_, slice_of_same_len_strings_group) in
435437
&reserved_names.into_iter().chunk_by(InlineString::len)

0 commit comments

Comments
 (0)