Skip to content

⚡ Bolt: [Avoid intermediate Vec allocations in execution tree hot paths] - #84

Closed
ovasylenko wants to merge 3 commits into
mainfrom
bolt/evaluator-tree-allocation-127087307332190317
Closed

⚡ Bolt: [Avoid intermediate Vec allocations in execution tree hot paths]#84
ovasylenko wants to merge 3 commits into
mainfrom
bolt/evaluator-tree-allocation-127087307332190317

Conversation

@ovasylenko

Copy link
Copy Markdown
Contributor

💡 What: Replaced usages of the children_of helper function (which clones references into an intermediate Vec) within .any(...) loops to directly iterate over the tree slice using .iter().any(|c| ...).

🎯 Why: In recursive evaluation loops (is_inside_decided_race, has_racing_composite_sibling), allocating a Vec just to test a boolean condition across children introduces unnecessary heap allocation and bypasses the performance benefits of short-circuiting iterators (since the Vec must be fully populated before .any(...) is checked).

📊 Impact: Reduces memory allocation frequency and overall CPU cycle time during tree traversals for step dispatch and cancellation checks on deep execution graphs, as memory no longer needs to be allocated and garbage collected for these intermediate arrays.

🔬 Measurement: Verified that tests pass via cargo test -p orch8-engine and formatting is correct via cargo +stable fmt. The optimization removes two Vec allocations per parent node visited during evaluation in these branches.


PR created automatically by Jules for task 127087307332190317 started by @ovasylenko

…t paths

Replaced the `children_of(...).into_iter().any(...)` pattern with a direct, zero-allocation short-circuiting `.iter().any(...)` on the execution tree in `orch8-engine/src/evaluator.rs`. This eliminates intermediate `Vec` creations in high-frequency cancellation and dispatch paths like `is_inside_decided_race` and `has_racing_composite_sibling`.

Co-authored-by: ovasylenko <3797513+ovasylenko@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

…t paths

Replaced the `children_of(...).into_iter().any(...)` pattern with a direct, zero-allocation short-circuiting `.iter().any(...)` on the execution tree in `orch8-engine/src/evaluator.rs`. This eliminates intermediate `Vec` creations in high-frequency cancellation and dispatch paths like `is_inside_decided_race` and `has_racing_composite_sibling`.

Also updated `anyhow` to fix `RUSTSEC-2026-0190` flagged by CI `cargo deny`.

Co-authored-by: ovasylenko <3797513+ovasylenko@users.noreply.github.com>
@ovasylenko

Copy link
Copy Markdown
Contributor Author

Same situation as #82: this PR implements the identical fix to is_inside_decided_race / has_racing_composite_sibling (avoiding the children_of(...).into_iter() allocation) that landed via #89. Also note the Cargo.lock hunk here (anyhow 1.0.102→1.0.103) is unrelated dependency drift, not part of the intended change. Redundant now — leaving open per repo convention, but no action needed unless you want to close it as superseded.

@google-labs-jules

Copy link
Copy Markdown
Contributor

Same situation as #82: this PR implements the identical fix to is_inside_decided_race / has_racing_composite_sibling (avoiding the children_of(...).into_iter() allocation) that landed via #89. Also note the Cargo.lock hunk here (anyhow 1.0.102→1.0.103) is unrelated dependency drift, not part of the intended change. Redundant now — leaving open per repo convention, but no action needed unless you want to close it as superseded.

Understood. Acknowledging that this work is now obsolete and stopping work on this task.

Co-authored-by: ovasylenko <3797513+ovasylenko@users.noreply.github.com>
@ovasylenko

Copy link
Copy Markdown
Contributor Author

Closing as superseded — see comment above (identical fix landed via #89).

@ovasylenko ovasylenko closed this Jul 6, 2026
@google-labs-jules

Copy link
Copy Markdown
Contributor

Closing as superseded — see comment above (identical fix landed via #89).

Understood. Acknowledging that this work is now obsolete and stopping work on this task.

@ovasylenko
ovasylenko deleted the bolt/evaluator-tree-allocation-127087307332190317 branch July 16, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant