perf(builder): boilerplate of prewarming for best transactions#3865
Merged
Conversation
c39065e to
1908417
Compare
69ad1ba to
775e11a
Compare
0540f20 to
f781c0a
Compare
f781c0a to
85b849a
Compare
749d3ad to
a742511
Compare
37172c1 to
99aec0d
Compare
99aec0d to
c0add3f
Compare
klkvr
approved these changes
May 11, 2026
Comment on lines
+46
to
+65
| loop { | ||
| if let Some(tx) = ctx.best_txs.next() { | ||
| if ctx | ||
| .events_tx | ||
| .send(BestTransactionsEvent::Transaction(tx)) | ||
| .is_err() | ||
| { | ||
| break; | ||
| } | ||
|
|
||
| // TODO: prewarm state by executing the transaction `tx` on top of latest state | ||
| } else { | ||
| // No more best transactions for now. We do not break the loop, | ||
| // because there may be more transactions later. | ||
| if ctx.events_tx.send(BestTransactionsEvent::Empty).is_err() { | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| while let Ok(command) = ctx.commands_rx.try_recv() { |
Member
There was a problem hiding this comment.
this would effectively hotloop until entire iterator is drained right? i guess maybe it's fine because we're just draining Arcs but we could probably change this so that the builder thread directly requests new transactions via something like BestTransactionsCommand::Advance(oneshot::Receiver)
in practice most of the time prewarming should be ahead so the buffer of transactions we've drained for prewarming workers should be enough for execution to advance, so it shouldn't be necessary to drain the entire iter
…ewarming # Conflicts: # Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-in
--builder.enable-prewarmingflag that enables prewarming thread that consumesbest_txsat its own speed, and buffers transactions for payload building to consume. Prewarming accounts for invalidations for buffered transactions.This PR doesn't do any prewarming yet, next step would be to start executing transactions on top of latest state and populating shared cache.
The flag is disabled by default, so existing payload building behavior is unchanged.