Cinder

A 10 ms wait that did its job and still lost: why we rejected it

TL;DR

Cinder can write each block at once (persist depth 0). Then the job that records the trie writes of a block often still runs when the writer takes the block. In that case the writer computes a state root over the batch. On 2026-11-09 we tried a bounded wait at the hand-over: at most 10 ms for the job. We replayed 3 000 Hoodi blocks in 5 rounds, with an A/A control. The wait did exactly what it should. The fallback went from 1 064 to 1 152 batches per run to 2 to 32. The job ended in about 1.6 ms by mean. But the time did not improve. newPayload took 1.042 of the time of A, and B was above A and A2 in 4 of 5 rounds. A bootstrap over the blocks put that ratio at 1.014 to 1.070, which looks certain. The same bootstrap put the A/A control at 0.934 to 0.993. That control compares two copies of one binary, so a real effect is impossible there. Thus the interval over blocks was too narrow. The interval over runs, 0.908 to 1.169, is the one to read. No gain and a possible cost: rejected. The issue stays open for mainnet and for two other options. This is work on the development line toward 1.0, not a release.

Some changes fail because they do not work. This one worked, and it still failed. I find that kind more interesting, and more useful, because the reason is in the method and not in the code.

This is work on the development line toward 1.0. Nothing from this experiment is in the code.

The problem: a job that is still running

Cinder can keep some blocks in memory before it writes them. With --persist-depth 0, the engine hands each new block to the writer thread at once.

While a block executes, a job records the trie writes of the block. If that job is done when the writer takes the block, the writer uses the recorded writes. If it is not done, the writer computes a state root over the batch itself. That is the fallback, and it is more work for the writer. At depth 0, the job of the newest block is often still running at the hand-over. In our runs, the fallback happened in 1 064 to 1 152 batches per run of 3 000 blocks.

The idea: wait a little. At the hand-over, the engine thread waits for the job, at most 10 ms, before it decides which path the batch takes.

The wait did its job

Count per run of 3 000 blocks A (5 runs) A2 (5 runs) B (5 runs)
Batches with a root over the batch 1 064 to 1 152 989 to 1 036 2 to 32
Waits 0 0 1 055 to 1 114
Waits that ended at 10 ms 0 0 2 to 32
Total wait 0 0 1 299 to 2 132 ms

The job ended within the limit in nearly every case, after about 1.6 ms by mean. The fallback almost vanished. If the question had been “does the wait remove the fallback?”, the answer was yes, and this post would be short.

The time did not follow

The question was “is the node faster?”. For that, the times count:

Per block A A2/A (interval over blocks) B/A (interval over blocks)
newPayload 52.8 ms 0.963 (0.934 to 0.993) 1.042 (1.014 to 1.070)
Writer 49.4 ms 0.955 (0.940 to 0.970) 1.027 (1.011 to 1.044)

Read the right column alone and you get a clean story: with the wait, newPayload takes 1.042 of the time of A, and the interval excludes 1. Certain. That is the overstated result that this post is about.

Now read the middle column. A2 is the same binary as A. Any difference between them is noise, by construction. Yet the interval over blocks says that A2 is faster than A, and it excludes 1 too. An interval that can “prove” a difference between a binary and its own copy is too narrow for this question. It treats every block as an independent sample. But the noise here comes per run: a run on a busy machine makes all of its 3 000 blocks slower together. The A runs had mean newPayload times of 45.0, 50.9, 52.7, 67.4 and 48.3 ms. One of five runs was far off, because of other load.

So we resampled the runs instead of the blocks:

Run level, 5 runs per arm B/A A2/A B/A2 Rounds with B above A, above A2
newPayload 1.042 (0.908 to 1.169) 0.963 (0.832 to 1.098) 1.081 (1.011 to 1.161) 4, 4
Writer total 1.041 (0.918 to 1.168) 0.978 (0.856 to 1.113) 1.065 (0.999 to 1.139) 4, 4
keptrejectedleft of 0 is faster
Wait on, against A: interval over blocksB/A 1.042 (1.014 to 1.070)+2.2 ms
A/A control: interval over blocksA2/A 0.963 (0.934 to 0.993): too narrow-1.9 ms
Wait on, against A: interval over runsB/A 1.042 (0.908 to 1.169)+2.2 ms
A/A control: interval over runsA2/A 0.963 (0.832 to 1.098)-1.9 ms
Change of the newPayload time per block against A, in ms: the ratio of the record minus 1, times the 52.8 ms of A. The dot is the same in both pairs. Only the interval changes. Right of 0 is slower. All grey: rejected. 3 000 Hoodi blocks, 5 rounds, desktop computer, 2026-11-09. Record: docs/results/2026-11-writer-depth0-wait.md.

The dots are the same in both pairs. Only the honesty of the interval changes. Over runs, the cost of the wait against A is not certain: the interval goes from 0.908 to 1.169. Against A2 it is 1.081, and its interval just excludes 1. And B was above both A and A2 in 4 of 5 rounds.

The decision

What we can say: the wait gave no gain, and maybe a cost. That is enough to reject a change. A change must show a gain to earn its place in the writer, and this one did not. No code is committed, and the scratch patch stays outside the repository.

What we cannot say: why. We did not find a cause. A likely one is that the engine thread stands idle for the wait while the next block could start. But that is not shown, and I will not write it as a finding.

What this does not show

The lesson I keep from this one: a bootstrap over blocks answers “how much do these blocks vary?”, not “how much do runs vary?”. Only the A/A control tells you which of the two questions your noise asks.