Skip to content

Commit

Permalink
reserve
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jan 13, 2025
1 parent de9f00f commit 574826e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/swc_ecma_transforms_optimization/src/simplify/dce/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,16 @@ impl Parallel for Analyzer<'_> {
fn merge(&mut self, other: Self) {
self.scope.ast_path = other.scope.ast_path;

self.scope
.bindings_affected_by_eval
.reserve(other.scope.bindings_affected_by_eval.len());
self.scope
.bindings_affected_by_eval
.extend(other.scope.bindings_affected_by_eval);

self.scope
.bindings_affected_by_arguements
.reserve(other.scope.bindings_affected_by_arguements.len());
self.scope
.bindings_affected_by_arguements
.extend(other.scope.bindings_affected_by_arguements);
Expand Down Expand Up @@ -1221,6 +1228,8 @@ where
S: BuildHasher,
{
fn merge(&mut self, other: Self) {
self.reserve(other.len());

for (k, v) in other {
match self.entry(k) {
std::collections::hash_map::Entry::Occupied(mut e) => {
Expand All @@ -1241,6 +1250,8 @@ where
S: BuildHasher,
{
fn merge(&mut self, other: Self) {
self.reserve(other.len());

for (k, v) in other {
match self.entry(k) {
indexmap::map::Entry::Occupied(mut e) => {
Expand Down

0 comments on commit 574826e

Please sign in to comment.