fn visit_par<N>(&mut self, nodes: &mut Vec<N>)
    where
        N: Send + Sync + for<'aa> VisitMutWith<Compressor<'aa, M>>,
    {
        tracing::debug!("visit_par(left_depth = {})", self.left_parallel_depth);

        if self.left_parallel_depth == 0 || cfg!(target_arch = "wasm32") {
            for node in nodes {
                let mut v = Compressor {
                    globals: self.globals,
                    marks: self.marks,
                    options: self.options,
                    changed: false,
                    pass: self.pass,
                    data: None,
                    left_parallel_depth: 0,
                    mode: self.mode,
                    dump_for_infinite_loop: Default::default(),
                };
                node.visit_mut_with(&mut v);

                self.changed |= v.changed;
            }
        } else {
            let results = nodes
                .par_iter_mut()
                .map(|node| {
                    swc_common::GLOBALS.set(&self.globals, || {
                        let mut v = Compressor {
                            globals: self.globals,
                            marks: self.marks,
                            options: self.options,
                            changed: false,
                            pass: self.pass,
                            data: None,
                            left_parallel_depth: self.left_parallel_depth - 1,
                            mode: self.mode,
                            dump_for_infinite_loop: Default::default(),
                        };
                        node.visit_mut_with(&mut v);

                        v.changed
                    })
                })
                .collect::<Vec<_>>();

            for changed in results {
                self.changed |= changed;
            }
        }
    }
/// Optimize a bundle in a parallel.
Optimize a bundle in a parallel.
Optimize a bundle in a parallel .
fn visit_par<N>(&mut self, nodes: &mut Vec<N>)
    where
        N: Send + Sync + for<'aa> VisitMutWith<Compressor<'aa, M>>,
    {
        tracing::debug!("visit_par(left_depth = {})", self.left_parallel_depth);
        if self.left_parallel_depth == 0 || cfg!(target_arch = "wasm32") {
            for node in nodes {
                let mut v = Compressor {
                    globals: self.globals,
                    marks: self.marks,
                    options: self.options,
                    changed: false,
                    pass: self.pass,
                    data: None,
                    left_parallel_depth: 0,
                    mode: self.mode,
                    dump_for_infinite_loop: Default::default(),
                };
                node.visit_mut_with(&mut v);
                self.changed |= v.changed;
            }
        } else {
            let results = nodes
                .par_iter_mut()
                .map(|node| {
                    swc_common::GLOBALS.set(&self.globals, || {
                        let mut v = Compressor {
                            globals: self.globals,
                            marks: self.marks,
                            options: self.options,
                            changed: false,
                            pass: self.pass,
                            data: None,
                            left_parallel_depth: self.left_parallel_depth - 1,
                            mode: self.mode,
                            dump_for_infinite_loop: Default::default(),
                        };
                        node.visit_mut_with(&mut v);
                        v.changed
                    })
                })
                .collect::<Vec<_>>();
            for changed in results {
                self.changed |= changed;
            }
        }
    }
fn visit_par < N > ( & mut self , nodes : & mut Vec < N > ) where N : Send + Sync + for < ' aa > VisitMutWith < Compressor < ' aa , M > > , { tracing :: debug ! ( " " self left_parallel_depth ) ; if self . left_parallel_depth == 0 || cfg ! ( target_arch " " ) { for node in nodes { let mut v = Compressor { globals : self . globals , marks : self . marks , options : self . options , changed : false , pass : self . pass , data : None , left_parallel_depth : 0 , mode : self . mode , dump_for_infinite_loop : Default :: default ( ) , } ; node . visit_mut_with ( & mut v ) ; self . changed |= v . changed ; } } else { let results = nodes . par_iter_mut ( ) . map ( | node | { swc_common :: GLOBALS . set ( & self . globals , | | { let mut v = Compressor { globals : self . globals , marks : self . marks , options : self . options , changed : false , pass : self . pass , data : None , left_parallel_depth : self . left_parallel_depth - 1 , mode : self . mode , dump_for_infinite_loop : Default :: default ( ) , } ; node . visit_mut_with ( & mut v ) ; v . changed } ) } ) . collect :: < Vec < _ > > ( ) ; for changed in results { self . changed |= changed ; } } }
Optimize a bundle in a parallel.
Optimize a bundle in a parallel .
&mut self
nodes
&mut Vec<N>