go-ethereum/nomt/core
weiihann 036e37809e nomt: optimize Hash() pipeline — pool hashers, eliminate redundant sorts, in-place merge
Performance optimizations to the NOMT storage engine while preserving
correctness (all triecompare cross-validation tests pass at 10K+ scale):

- Pool SHA256 hashers via sync.Pool in HashInternal and HashStem
- Replace allStems map with sorted slice + O(N+M) merge (in-place fast
  path for incremental updates avoids allocation entirely)
- Add UpdateSorted to db.DB, skipping redundant sort of pre-sorted ops
- Simplify canonicalRoot to use pre-sorted allStems directly
- Optimize StemSharedBits with byte-level XOR + bits.LeadingZeros8
- Replace stemLess loops with bytes.Compare in all locations
- Eliminate per-stem map alloc in groupAndHashStems (use [256]bool dirty)
- Use stack-allocated [248]bool for downBits in BuildInternalTree
- Remove unused stemPathCmp function

BenchmarkHash/10000/nomt: 9.8ms → 8.2ms (-16%)
BenchmarkBlockWorkload/nomt: 7.7ms → 6.6ms (-14%)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 01:11:59 +08:00
..
hasher.go nomt: optimize Hash() pipeline — pool hashers, eliminate redundant sorts, in-place merge 2026-02-13 01:11:59 +08:00
node.go nomt/core: redesign for EIP-7864 compatibility (Phase A) 2026-02-12 21:59:53 +08:00
node_test.go nomt/core: redesign for EIP-7864 compatibility (Phase A) 2026-02-12 21:59:53 +08:00
page.go nomt/core: add Phase 1 core primitives for NOMT binary merkle trie 2026-02-12 17:05:00 +08:00
page_test.go nomt/core: add Phase 1 core primitives for NOMT binary merkle trie 2026-02-12 17:05:00 +08:00
pagediff.go nomt/core: add Phase 1 core primitives for NOMT binary merkle trie 2026-02-12 17:05:00 +08:00
pagediff_test.go nomt/core: add Phase 1 core primitives for NOMT binary merkle trie 2026-02-12 17:05:00 +08:00
pageid.go nomt/core: add Phase 1 core primitives for NOMT binary merkle trie 2026-02-12 17:05:00 +08:00
pageid_test.go nomt/core: add Phase 1 core primitives for NOMT binary merkle trie 2026-02-12 17:05:00 +08:00
triepos.go nomt/core: redesign for EIP-7864 compatibility (Phase A) 2026-02-12 21:59:53 +08:00
triepos_test.go nomt/core: redesign for EIP-7864 compatibility (Phase A) 2026-02-12 21:59:53 +08:00
update.go nomt: optimize Hash() pipeline — pool hashers, eliminate redundant sorts, in-place merge 2026-02-13 01:11:59 +08:00
update_test.go nomt/core: redesign for EIP-7864 compatibility (Phase A) 2026-02-12 21:59:53 +08:00