swc_core::ecma::transforms::base::perf

Trait ParallelExt

pub trait ParallelExt: Parallel {
    // Required method
    fn maybe_par_idx<I, F>(&mut self, threshold: usize, nodes: I, op: F)
       where I: Items,
             F: Send + Sync + Fn(&mut Self, usize, <I as Items>::Elem);

    // Provided method
    fn maybe_par<I, F>(&mut self, threshold: usize, nodes: I, op: F)
       where I: Items,
             F: Send + Sync + Fn(&mut Self, <I as Items>::Elem) { ... }
}
Available on crate feature __ecma and (crate features __ecma_transforms or __testing_transform) only.

Required Methods§

fn maybe_par_idx<I, F>(&mut self, threshold: usize, nodes: I, op: F)
where I: Items, F: Send + Sync + Fn(&mut Self, usize, <I as Items>::Elem),

Invoke op in parallel, if swc_ecma_utils is compiled with concurrent feature enabled and nodes.len() is bigger than threshold.

This configures GLOBALS, while not configuring [HANDLER] nor [HELPERS]

Provided Methods§

fn maybe_par<I, F>(&mut self, threshold: usize, nodes: I, op: F)
where I: Items, F: Send + Sync + Fn(&mut Self, <I as Items>::Elem),

Invoke op in parallel, if swc_ecma_utils is compiled with concurrent feature enabled and nodes.len() is bigger than threshold.

This configures GLOBALS, while not configuring [HANDLER] nor [HELPERS]

Object Safety§

This trait is not object safe.

Implementors§

§

impl<T> ParallelExt for T
where T: Parallel,