Skip to content

Commit d97fe8d

Browse files
author
Cameron McHenry
committed
refactor(mangler): use bump allocator for internal storage
1 parent ba6c24b commit d97fe8d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/oxc_mangler/src/lib.rs

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

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

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

428428
let mut freq_iter = frequencies.iter();
429-
let mut symbols_renamed_in_this_batch = std::vec::Vec::with_capacity(100);
430-
let mut slice_of_same_len_strings = std::vec::Vec::with_capacity(100);
429+
let mut symbols_renamed_in_this_batch = Vec::with_capacity_in(100, temp_allocator);
430+
let mut slice_of_same_len_strings = Vec::with_capacity_in(100, temp_allocator);
431431
// 2. "N number of vars are going to be assigned names of the same length"
432432
for (_, slice_of_same_len_strings_group) in
433433
&reserved_names.into_iter().chunk_by(InlineString::len)

0 commit comments

Comments
 (0)