Commit 5d72117
perf(pact_matching): Eliminate redundant tree-cloning in V2 engine interpreter
Change walk_tree and all execute_* methods to take ExecutionPlanNode by value
instead of by reference. The interpreter now moves/transforms the plan tree
into the executed tree rather than cloning it.
Key changes:
- walk_tree: &ExecutionPlanNode -> ExecutionPlanNode; CONTAINER and PIPELINE
branches use children.into_iter() instead of VecDeque::from(children.clone()),
and push(child_result) instead of push(child_result.clone())
- execute_action and all ~25 execute_* methods: owned node, destructure at top
- validate_one/two/three_args and validate_args: take Vec<ExecutionPlanNode>
directly, use into_iter() to move children to walk_tree
- evaluate_children: takes children: Vec<ExecutionPlanNode> by value
- execute_plan: clones plan_root once at entry (public API unchanged)
Benchmark results (execute phase):
text body: -30%
JSON equality: -35%
JSON with rules: -33%
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 70dea3d commit 5d72117
2 files changed
Lines changed: 471 additions & 369 deletions
0 commit comments