mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 09:51:36 +00:00
Gballet asked on PR #34055 (comments 3100043116, 3100050542, and the bit-check dedup at 3100114416 / 3100878310) to revert StemNode from the packed-bytes representation to the straightforward array-of-slices. Before: StemNode carried a bitmap, a concatenated valueData []byte, a count, and a shared COW flag. Every read/write went through a bit-count posInData lookup; every mutation through ensureWritable COW. After: values [StemNodeWidth][]byte — 256 slots, nil == absent. No bitmap lookup, no COW. Direct sn.values[suffix] access. Supporting changes: - Drop posInData, ensureWritable; rewrite getValue/hasValue/allValues/ setValue as trivial slice access. - Hash() iterates sn.values directly, matching master's shape. - SerializeNode emits the bitmap + concatenated bytes on the wire from the array-of-slices at serialize time; wire format unchanged. - decodeNode populates sn.values[i] slots by aliasing the serialized buffer (zero-copy). - NodeStore.Copy deep-copies each slot. - splitStemValuesInsert + the insertSingleInternal paths write directly to sn.values[i]. Trade-off: stems now carry 256 []byte headers (6144 B) instead of 1 concatenated slice (~32 B) + bitmap. Stem-pool scan cost returns to parity with master (the existing valueData pointer already made the pool non-noscan; rollback adds 255 more pointers per stem). The primary arena win — pointer-free InternalNode pool — is preserved. |
||
|---|---|---|
| .. | ||
| bintrie | ||
| transitiontrie | ||
| trienode | ||
| bytepool.go | ||
| committer.go | ||
| database_test.go | ||
| encoding.go | ||
| encoding_test.go | ||
| errors.go | ||
| hasher.go | ||
| inspect.go | ||
| inspect_test.go | ||
| iterator.go | ||
| iterator_test.go | ||
| levelstats.go | ||
| levelstats_test.go | ||
| list_hasher.go | ||
| node.go | ||
| node_enc.go | ||
| node_test.go | ||
| proof.go | ||
| proof_test.go | ||
| secure_trie.go | ||
| secure_trie_test.go | ||
| stacktrie.go | ||
| stacktrie_fuzzer_test.go | ||
| stacktrie_test.go | ||
| sync.go | ||
| sync_test.go | ||
| tracer.go | ||
| tracer_test.go | ||
| trie.go | ||
| trie_id.go | ||
| trie_reader.go | ||
| trie_test.go | ||