go-ethereum/trie
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
..
bintrie use bitarray 2026-02-12 15:17:10 +08:00
nomttrie nomt: optimize Hash() pipeline — pool hashers, eliminate redundant sorts, in-place merge 2026-02-13 01:11:59 +08:00
transitiontrie cmd/evm/internal/t8ntool, trie: support for verkle-at-genesis, use UBT, and move the transition tree to its own package (#32445) 2025-11-14 15:25:30 +01:00
triecompare nomt: add triecompare package and fix sort.SliceStable bug in stem grouping 2026-02-13 00:07:04 +08:00
trienode cmd, core, eth, triedb/pathdb: track node origins in the path database (#32418) 2025-09-05 10:37:05 +08:00
bytepool.go core/types, trie: reduce allocations in derivesha (#30747) 2025-10-01 10:05:49 +02:00
committer.go trie/bintrie: add eip7864 binary trees and run its tests (#32365) 2025-09-01 21:06:51 +08:00
database_test.go trie: no need to store preimage if not enabled (#32012) 2025-06-13 15:04:24 +08:00
encoding.go trie: reduce allocations in stacktrie (#30743) 2025-01-23 10:17:12 +01:00
encoding_test.go trie: reduce allocs in recHash (#27770) 2023-08-18 22:41:19 +02:00
errors.go all: fix various typos (#29600) 2024-04-23 13:09:42 +03:00
hasher.go trie: reduce the memory allocation in trie hashing (#31902) 2025-08-01 10:23:23 +08:00
iterator.go trie: add sub-trie iterator support (#32520) 2025-09-17 22:07:02 +08:00
iterator_test.go trie: align AllFFPrefix test assertion and message (#32719) 2025-09-24 10:36:56 +08:00
list_hasher.go core/types, trie: reduce allocations in derivesha (#30747) 2025-10-01 10:05:49 +02:00
node.go trie: fix embedded node size validation (#33803) 2026-02-10 22:05:39 +08:00
node_enc.go trie: reduce the memory allocation in trie hashing (#31902) 2025-08-01 10:23:23 +08:00
node_test.go trie: fix flaky test (#33711) 2026-01-29 17:22:15 +08:00
proof.go trie/bintrie: add eip7864 binary trees and run its tests (#32365) 2025-09-01 21:06:51 +08:00
proof_test.go trie: fix TestOneElementProof expected value message (#32738) 2025-09-24 18:57:01 -06:00
secure_trie.go trie: preallocate slice capacity (#33689) 2026-01-27 12:04:12 +08:00
secure_trie_test.go core/state, eth/protocols, trie, triedb/pathdb: remove unused error from trie Commit (#29869) 2024-06-12 12:23:16 +03:00
stacktrie.go core/types, trie: reduce allocations in derivesha (#30747) 2025-10-01 10:05:49 +02:00
stacktrie_fuzzer_test.go trie: do not expect ordering in stacktrie during fuzzing (#31170) 2025-02-18 10:48:42 +08:00
stacktrie_test.go trie: reduce allocations in stacktrie (#30743) 2025-01-23 10:17:12 +01:00
sync.go trie: cleaner array concatenation (#32756) 2025-10-02 17:32:20 +02:00
sync_test.go core, trie, triedb: minor changes from snapshot integration (#30599) 2024-10-18 17:06:31 +02:00
tracer.go trie/bintrie: add eip7864 binary trees and run its tests (#32365) 2025-09-01 21:06:51 +08:00
tracer_test.go trie, core/state: introduce trie Prefetch for optimizing preload (#32134) 2025-08-20 21:45:27 +08:00
trie.go core/types, trie: reduce allocations in derivesha (#30747) 2025-10-01 10:05:49 +02:00
trie_id.go all: update license comments and AUTHORS (#31133) 2025-02-05 23:01:17 +01:00
trie_reader.go trie/bintrie: add eip7864 binary trees and run its tests (#32365) 2025-09-01 21:06:51 +08:00
trie_test.go crypto/keccak: vendor in golang.org/x/crypto/sha3 (#33323) 2026-02-03 14:55:27 -07:00