mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
trie/trie_test: Fix Trie Benchmark Bug: Ensure Key Immutability in geth Benchmarks
This commit is contained in:
parent
b9450bfcca
commit
3ee96b35ad
1 changed files with 4 additions and 2 deletions
|
|
@ -627,11 +627,13 @@ func benchGet(b *testing.B) {
|
|||
|
||||
func benchUpdate(b *testing.B, e binary.ByteOrder) *Trie {
|
||||
trie := NewEmpty(NewDatabase(rawdb.NewMemoryDatabase(), nil))
|
||||
k := make([]byte, 32)
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
k := make([]byte, 32)
|
||||
v := make([]byte, 32)
|
||||
e.PutUint64(k, uint64(i))
|
||||
trie.MustUpdate(k, k)
|
||||
e.PutUint64(v, uint64(i))
|
||||
trie.MustUpdate(k, v)
|
||||
}
|
||||
return trie
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue