Skip to content

⚡ Bolt: Use borrowed BlockId in batch fetch#55

Open
ovasylenko wants to merge 4 commits into
mainfrom
bolt-borrowed-blockid-batch-fetch-6193250396225194741
Open

⚡ Bolt: Use borrowed BlockId in batch fetch#55
ovasylenko wants to merge 4 commits into
mainfrom
bolt-borrowed-blockid-batch-fetch-6193250396225194741

Conversation

@ovasylenko

Copy link
Copy Markdown
Contributor

💡 What:
Updated the Storage trait's get_block_outputs_batch signature from keys: &[(InstanceId, BlockId)] to keys: &[(InstanceId, &BlockId)]. Also updated the corresponding implementations in Postgres, SQLite, and Encrypting decorators, and replaced .clone() calls in the scheduler's deadline iteration hot-path with borrowing logic.

🎯 Why:
To prevent allocating hundreds or thousands of Strings per tick. When preparing batch fetches for block outputs (especially related to SLAs/deadlines), the engine was mapping through sequence definitions and deeply cloning the BlockId strings just to fulfill the trait's parameter type.

📊 Impact:
Removes 1 heap allocation per block instance evaluation in the scheduler's deadline_keys collection logic, reducing GC/allocator pressure in the hot loop.

🔬 Measurement:
Run cargo run -p orch8-engine under a profiler (like flamegraph) or load testing scenario. The time spent in memory allocation within the scheduler loop (specifically related to building the deadline_keys vector) should be measurably reduced. Validated correctness via cargo clippy -p orch8-storage -p orch8-engine and cargo test -p orch8-engine --lib scheduler::tests.


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

Change the Storage trait's `get_block_outputs_batch` to accept
references for BlockId, avoiding unnecessary String cloning in
the engine's scheduler hot path.

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.

google-labs-jules Bot and others added 3 commits June 9, 2026 20:07
Change the Storage trait's `get_block_outputs_batch` to accept
references for BlockId, avoiding unnecessary String cloning in
the engine's scheduler hot path.

Co-authored-by: ovasylenko <3797513+ovasylenko@users.noreply.github.com>
Change the Storage trait's `get_block_outputs_batch` to accept
references for BlockId, avoiding unnecessary String cloning in
the engine's scheduler hot path.

Co-authored-by: ovasylenko <3797513+ovasylenko@users.noreply.github.com>
Change the Storage trait's `get_block_outputs_batch` to accept
references for BlockId, avoiding unnecessary String cloning in
the engine's scheduler hot path. Also fixes tests and fmt.

Co-authored-by: ovasylenko <3797513+ovasylenko@users.noreply.github.com>
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