phase 7: fix @each to stay sequential (RheiContext not Sync); keep compute_batch/matching_rules_batch in style.rs
This commit is contained in:
@@ -427,44 +427,13 @@ impl Interpreter {
|
||||
|
||||
let child_refs: Vec<&Element<'a>> = el.children.iter().collect();
|
||||
|
||||
#[cfg(feature = "parallel")]
|
||||
if items.len() >= 10 {
|
||||
use rayon::prelude::*;
|
||||
let var_name_owned = var_name.to_string();
|
||||
let vars_snapshot = variables.clone();
|
||||
let results: Vec<Vec<Element<'a>>> = items
|
||||
.par_iter()
|
||||
.map(|item| {
|
||||
let mut local_vars = vars_snapshot.clone();
|
||||
local_vars.insert(var_name_owned.clone(), Value::Str(CompactString::new(item)));
|
||||
Self::evaluate_vdom_incr(
|
||||
&child_refs, &mut local_vars, components, rhei, stylesheet, ancestors, dirty_set,
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
for result in results {
|
||||
output.extend(result);
|
||||
}
|
||||
} else {
|
||||
for item in items {
|
||||
let old_val = variables.insert(var_name.to_string(), Value::Str(CompactString::new(item)));
|
||||
output.extend(Self::evaluate_vdom_incr(
|
||||
&child_refs, variables, components, rhei, stylesheet, ancestors, dirty_set,
|
||||
));
|
||||
if let Some(old) = old_val {
|
||||
variables.insert(var_name.to_string(), old);
|
||||
} else {
|
||||
variables.remove(var_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "parallel"))]
|
||||
for item in items {
|
||||
let old_val = variables.insert(var_name.to_string(), Value::Str(CompactString::new(item)));
|
||||
output.extend(Self::evaluate_vdom_incr(
|
||||
&child_refs, variables, components, rhei, stylesheet, ancestors, dirty_set,
|
||||
));
|
||||
|
||||
if let Some(old) = old_val {
|
||||
variables.insert(var_name.to_string(), old);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user