Where a mainnet block spends its time, and five changes that cut it
TL;DR
On the live node, a block also waits for the database. This post shows how we found where the time goes, and five changes that each removed a part of it.
2026-10-07. Measured on the desktop against reth 2.0, before testing moved to a dedicated server. The numbers are kept as they were measured.
Cinder’s engine executes mainnet blocks about twice as fast as reth’s stateless validator of that time on the same blocks (1.95× in CPU time on one core, measured with v0.1.0). But the engine alone is not the node. On the live node, a block also waits for the database. This post shows how we found where the time goes, and five changes that each removed a part of it. The before-and-after tables come from interleaved A/B runs on the live mainnet node: odd blocks take one path, even blocks the other, in the same process. Thus both paths see the same minutes and the same load. Each A/B ran on a different day and under a different load, so compare the numbers within a table, not across tables.
Step 1: measure the executing thread, not the process
A process-wide profile mixes the executing thread with the prewarm threads (they run the block’s transactions ahead of time to load their data), the trie prefetch and the writer (the thread that writes finished blocks to the database). We wanted the critical path only. So a temporary sampler recorded the executing thread every 0.5 ms of its CPU time while a block executed. And per-block counters split the wall time of execution into CPU time and time spent waiting on reads.
One sample of 55 blocks:
| mean | median | |
|---|---|---|
| wall time of execution | 87.2 ms | 72.2 ms |
| CPU time of the executing thread | 49.4 ms | 46.0 ms |
| waiting on reads | 34.7 ms | 22.0 ms |
A block waited on reads for about 40% of its execution time.
Of the ~567 reads the executing thread waited on per block, ~355 were contract bytecode: about 2.8 MB, read from the database again in every block.
1. Contract bytecode kept by its hash
Code never changes under its hash. That makes it the easiest thing in Ethereum to cache: no invalidation at all. Cinder now keeps code in a process-wide table keyed by code hash, up to 128 MB. Entries are never removed, so the pointers that the table hands out stay valid, and lookups take no lock.
| before | code cache | |
|---|---|---|
| reads waited on per block | 573 | 168 |
| execution per Mgas | 5.27 ms | 4.13 ms |
newPayload, mean |
219 ms | 169 ms |
Execution per Mgas -22%, and 70% fewer reads on the critical path. (Mgas is millions of gas, a measure of the work in a block. Time per Mgas lets us compare blocks of different sizes.)
2. JUMPDEST maps kept across blocks
Before the EVM runs a contract, it must know which bytes are valid jump
targets (the JUMPDEST bytes). Cinder cached that map per block. The CPU sampler showed that
jd_analyze was 13.8% of the executing thread’s CPU: every popular
contract was analyzed again in every block. Now each executing thread
keeps the maps across blocks, keyed by code hash, with an upper limit of
32 MB per thread. An entry that the current call uses is never replaced.
Later: one shared table for the process, up to 64 MB.
The share of jd_analyze went from 13.8% to 4.7%, about 5 ms of CPU per
block.
3. Senders from the pool
A transaction’s sender is recovered from its signature with secp256k1,
which is expensive. About half of a block’s transactions are already in
the node’s transaction pool, which recovered their sender at admission.
The block did it again. Now engine_newPayload takes the sender from the
pool when the pool has the same transaction hash. The same hash means the
same signed bytes. The time before execution starts went from 5.7 ms to 4.1 ms on
average.
4. Senders recovered beside execution
The other half was still recovered before execution, on a thread pool, while the executing thread waited. Now each transaction carries an atomic claim with three states: nobody has it, a thread recovers it, done. Execution starts at once. At each transaction it uses the recovered sender, or waits for the thread that recovers it, or recovers it itself.
We tried two places for the recovery. The prewarm threads (low priority) lagged under load, so execution recovered most senders itself, and the prewarm spent its time on signatures instead of warming. The compute pool, which is idle while a block executes, worked:
| senders first | beside execution | |
|---|---|---|
| wait before execution | 3.24 ms | 0.07 ms |
| read wait, mean | 43.5 ms | 29.9 ms |
newPayload per Mgas |
4.35 ms | 3.75 ms |
The read wait dropped too, because the prewarm now starts at once and has more time before execution needs its reads. ThreadSanitizer found one race on the way: a prewarm run read a sender while the pool still wrote it. The prewarm now claims or waits like everyone else.
5. A second prewarm pass
The prewarm runs the block’s transactions speculatively on other threads, so that their reads are in the cache when execution reaches them. A speculative run only sees the writes of earlier transactions that finished before it started. A run that started too early reads the parent’s state and misses the keys that the real sequence reaches.
Now the prewarm has a second pass. A transaction runs again if earlier transactions published new writes after its first run started, and execution has not reached it yet.
| one pass | two passes | |
|---|---|---|
| reads waited on per block | 220 | 185 |
| read wait, mean | 85.3 ms | 58.8 ms |
newPayload per Mgas |
6.01 ms | 5.38 ms |
Each change took time off a block in its own A/B.
| Row | before the change | with the change |
|---|---|---|
| Bytecode kept by hash: execution per Mgas | 5.3 ms per Mgas | 4.1 ms per Mgas |
| Senders beside execution: newPayload per Mgas | 4.3 ms per Mgas | 3.8 ms per Mgas |
| Second prewarm pass: newPayload per Mgas | 6.0 ms per Mgas | 5.4 ms per Mgas |
The small ones
Not every change is large. A line-level profile of the interpreter showed that PUSH was ~28% of it (a 32-byte buffer zeroed, a copy and a byte swap for every PUSH) and the per-opcode dispatch ~23%. PUSH1 to PUSH8 now load one word and shift it, and three hook tests became one flag per call frame: 1 to 2% on the engine (1.013× in total), measured offline on 196 mainnet blocks. PGO (a build tuned with a profile of real runs) and ThinLTO (optimization across source files) together gave about 5% (1.049×). We keep such changes even when one of them is inside the noise of a live A/B, because small gains add up.
What we take from it
- Profile the critical thread, and split its time into CPU and waiting. The two need different fixes.
- Content-addressed data (code by hash) is the cheapest cache you will ever write.
- If two components compute the same thing, let one hand it to the other: the pool’s senders, the prewarm’s reads.
- A speculative run is only as good as the state it saw. Give it a second look when the state moved.
Updated 2026-10-23: the comparison with reth’s stateless validator is from v0.1.0 against reth of that time. The live comparisons with reth now run on a dedicated server against reth 2.7. Each table above is one A/B on one day, so compare within a table only. Every number in this post is now checked against the measurement record.