go-ethereum/trie/bintrie
CPerezz 33227e7e6d
trie/bintrie: merge *Single paths into *ValuesAtStem
Per gballet's comment 3101751325 on PR #34055: the *Single functions
are essentially the same thing as *ValuesAtStem with one slot set. The
original design dispatched through *ValuesAtStem for dedup; this commit
restores that shape on the arena side.

- GetValue now delegates to GetValuesAtStem and indexes the returned
  256-slot array header (no allocation — the stem node returns its own
  inline values array as a slice).
- InsertSingle now builds a stack-allocated [StemNodeWidth][]byte with
  only the target slot set and delegates to InsertValuesAtStem.
- Delete the insertSingleInternal tree walker (~90 LOC) and the whole
  splitStemInsert (~60 LOC) — the *ValuesAtStem / splitStemValuesInsert
  pair already handles every case.

Addresses gballet comments 3101751325, 3101739001, 3101724199, 3101721238
(the last three subsumed by the consolidation — the duplicated helper
bodies no longer exist).

Net: ~150 LOC removed from store_ops.go. Allocation cost for InsertSingle
is bounded by the stack-allocated 256-slot array (one stack frame, no
heap allocation on the hot path).
2026-04-18 18:57:23 +02:00
..
binary_node.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00
binary_node_test.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00
hashed_node.go trie/bintrie: use type alias for HashedNode 2026-04-18 18:38:37 +02:00
hashed_node_test.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00
hasher.go trie/bintrie: revert sha256 helper + parallelHashDepth constant 2026-04-18 18:50:45 +02:00
internal_node.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00
internal_node_test.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00
iterator.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00
iterator_test.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00
key_encoding.go trie/bintrie: spec change, big endian hashing of slot key (#34670) 2026-04-13 09:42:37 +02:00
node_ref.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00
node_store.go trie/bintrie: trim storeChunkSize doc comment 2026-04-18 18:53:23 +02:00
stem_node.go trie/bintrie: simplify StemNode to array-of-slices representation 2026-04-18 18:53:07 +02:00
stem_node_test.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00
store_commit.go trie/bintrie: simplify StemNode to array-of-slices representation 2026-04-18 18:53:07 +02:00
store_ops.go trie/bintrie: merge *Single paths into *ValuesAtStem 2026-04-18 18:57:23 +02:00
trie.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00
trie_test.go trie/bintrie: unexport package-internal arena identifiers 2026-04-18 18:49:04 +02:00