mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-13 10:21:37 +00:00
Post-rollback pprof on BenchmarkCollectNodesSparseWrite revealed collectNodes' per-descent leftPath/rightPath make+copy as 13% of alloc_objects (~26 allocs/op). Replace with append/truncate on a shared buffer pre-sized by Commit; flushfn consumers (NodeSet.AddNode, tracer.Get) already clone via string(path), so in-place reuse is safe. Benchmark delta (M4 Pro, go1.24.0, --count=5 --benchtime=5s): before: 9506 ns/op 15245 B/op 132 allocs/op after: 9095 ns/op 15008 B/op 106 allocs/op vs upstream/master@53ff723cc: allocs/op now -20.9% (was -1.5%). |
||
|---|---|---|
| .. | ||
| binary_node.go | ||
| binary_node_test.go | ||
| hashed_node.go | ||
| hashed_node_test.go | ||
| hasher.go | ||
| internal_node.go | ||
| internal_node_test.go | ||
| iterator.go | ||
| iterator_test.go | ||
| key_encoding.go | ||
| node_ref.go | ||
| node_store.go | ||
| stem_node.go | ||
| stem_node_test.go | ||
| store_commit.go | ||
| store_ops.go | ||
| trie.go | ||
| trie_test.go | ||