Skip to content

Commit 6d377a2

Browse files
author
Cameron McHenry
committed
refactor(mangler): use bump allocator for internal storage
1 parent 99fa7c4 commit 6d377a2

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
@@ -221,9 +221,9 @@ impl<'m> Mangler<'m> {
221221

222222
// Stores the lived scope ids for each slot. Keyed by slot number.
223223
let mut slot_liveness: std::vec::Vec<FixedBitSet> = vec![];
224-
let mut tmp_bindings = std::vec::Vec::with_capacity(100);
224+
let mut tmp_bindings = Vec::with_capacity_in(100, self.allocator);
225225

226-
let mut reusable_slots = std::vec::Vec::new();
226+
let mut reusable_slots = Vec::new_in(self.allocator);
227227
// Walk down the scope tree and assign a slot number for each symbol.
228228
// It is possible to do this in a loop over the symbol list,
229229
// but walking down the scope tree seems to generate a better code.
@@ -342,8 +342,8 @@ impl<'m> Mangler<'m> {
342342
// function fa() { .. } function ga() { .. }
343343

344344
let mut freq_iter = frequencies.iter();
345-
let mut symbols_renamed_in_this_batch = std::vec::Vec::with_capacity(100);
346-
let mut slice_of_same_len_strings = std::vec::Vec::with_capacity(100);
345+
let mut symbols_renamed_in_this_batch = Vec::with_capacity_in(100, self.allocator);
346+
let mut slice_of_same_len_strings = Vec::with_capacity_in(100, self.allocator);
347347
// 2. "N number of vars are going to be assigned names of the same length"
348348
for (_, slice_of_same_len_strings_group) in
349349
&reserved_names.into_iter().chunk_by(InlineString::len)

0 commit comments

Comments
 (0)