1
0
Fork 0
forked from forks/go-ethereum
go-ethereum-modded-tocallarg/trie
Martin Holst Swende 5bf8769fb0
ethdb/memorydb, trie: reduced allocations (#28473)
* trie: use pooling of iterator states in iterator

The node iterator burns through a lot of memory while iterating a trie, and a lot of
that can be avoided by using a fairly small pool (max 40 items).

name        old time/op    new time/op    delta
Iterator-8    6.22ms ± 3%    5.40ms ± 6%  -13.18%  (p=0.008 n=5+5)

name        old alloc/op   new alloc/op   delta
Iterator-8    2.36MB ± 0%    1.67MB ± 0%  -29.23%  (p=0.008 n=5+5)

name        old allocs/op  new allocs/op  delta
Iterator-8     37.0k ± 0%     29.8k ± 0%     ~     (p=0.079 n=4+5)

* ethdb/memorydb: avoid one copying of key

By making the transformation from []byte to string at an earlier point,
we save an allocation which otherwise happens later on.

name           old time/op    new time/op    delta
BatchAllocs-8     412µs ± 6%     382µs ± 2%   -7.18%  (p=0.016 n=5+4)

name           old alloc/op   new alloc/op   delta
BatchAllocs-8     480kB ± 0%     490kB ± 0%   +1.93%  (p=0.008 n=5+5)

name           old allocs/op  new allocs/op  delta
BatchAllocs-8     3.03k ± 0%     2.03k ± 0%  -32.98%  (p=0.008 n=5+5)
2023-11-15 16:20:34 +01:00
..
testutil
triedb
trienode cmd, core, trie: verkle-capable geth init (#28270) 2023-11-14 13:09:40 +01:00
triestate
utils cmd, core, trie: verkle-capable geth init (#28270) 2023-11-14 13:09:40 +01:00
committer.go
database.go cmd, core, trie: verkle-capable geth init (#28270) 2023-11-14 13:09:40 +01:00
database_test.go
encoding.go
encoding_test.go
errors.go
hasher.go trie: spelling - fix comments in hasher (#28507) 2023-11-14 14:27:07 +01:00
iterator.go ethdb/memorydb, trie: reduced allocations (#28473) 2023-11-15 16:20:34 +01:00
iterator_test.go ethdb/memorydb, trie: reduced allocations (#28473) 2023-11-15 16:20:34 +01:00
node.go
node_enc.go
node_test.go
preimages.go
proof.go
proof_test.go
secure_trie.go
secure_trie_test.go
stacktrie.go
stacktrie_fuzzer_test.go tests/fuzzers: move fuzzers into native packages (#28467) 2023-11-14 14:34:29 +01:00
stacktrie_test.go
sync.go
sync_test.go ethdb/memorydb, trie: reduced allocations (#28473) 2023-11-15 16:20:34 +01:00
tracer.go
tracer_test.go
trie.go
trie_id.go
trie_reader.go
trie_test.go tests/fuzzers: move fuzzers into native packages (#28467) 2023-11-14 14:34:29 +01:00
verkle.go cmd, core, trie: verkle-capable geth init (#28270) 2023-11-14 13:09:40 +01:00
verkle_test.go cmd, core, trie: verkle-capable geth init (#28270) 2023-11-14 13:09:40 +01:00