Skip to content

Commit

Permalink
Optimize maybe_par_idx
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jan 12, 2025
1 parent f404720 commit b04b6a0
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions crates/swc_ecma_utils/src/parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,23 @@ where
}

let (na, nb) = nodes.split_at(len / 2);
let mut vb = Parallel::create(&*self);

let (va, vb) = join(
let (_, vb) = join(
|| {
GLOBALS.set(globals, || {
let mut visitor = Parallel::create(&*self);
visitor.maybe_par_idx_raw(threshold, na, op);

visitor
self.maybe_par_idx_raw(threshold, na, op);
})
},
|| {
GLOBALS.set(globals, || {
let mut visitor = Parallel::create(&*self);
visitor.maybe_par_idx_raw(threshold, nb, op);
vb.maybe_par_idx_raw(threshold, nb, op);

visitor
vb
})
},
);

Parallel::merge(self, va);
Parallel::merge(self, vb);
});

Expand Down

0 comments on commit b04b6a0

Please sign in to comment.