Files
Michael Sproul c451ae763c Use BTreeMap for state.validators pending updates (#9017)
Closes:

- https://github.com/sigp/lighthouse/issues/9003


  Milhouse `List`s use a map in front of the binary tree to cache updates. Ever since we adopted Milhouse, we've been using `VecMap`, which is essentially `Vec<Option<T>>`. Turns out, when you've got 2M indices and only 2 non-`None` entries (changes), this is inefficient.

Milhouse is generic in the choice of map (`U: UpdateMap`) and has always supported `BTreeMap`, so this PR switches us over to `BTreeMap`. In previous benchmarks (years ago) it had been slower than `VecMap`, but now it is vastly superior.


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-03-24 01:43:19 +00:00
..