mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
trie: close temporary databases in GetDB benchmark
This commit is contained in:
parent
bfe3da83e2
commit
2819f1c324
1 changed files with 8 additions and 2 deletions
|
|
@ -460,8 +460,7 @@ const benchElemCount = 20000
|
|||
func benchGet(b *testing.B, commit bool) {
|
||||
trie := new(Trie)
|
||||
if commit {
|
||||
dir, tmpdb := tempDB()
|
||||
defer os.RemoveAll(dir)
|
||||
_, tmpdb := tempDB()
|
||||
trie, _ = New(common.Hash{}, tmpdb)
|
||||
}
|
||||
k := make([]byte, 32)
|
||||
|
|
@ -478,6 +477,13 @@ func benchGet(b *testing.B, commit bool) {
|
|||
for i := 0; i < b.N; i++ {
|
||||
trie.Get(k)
|
||||
}
|
||||
b.StopTimer()
|
||||
|
||||
if commit {
|
||||
ldb := trie.db.(*ethdb.LDBDatabase)
|
||||
ldb.Close()
|
||||
os.RemoveAll(ldb.Path())
|
||||
}
|
||||
}
|
||||
|
||||
func benchUpdate(b *testing.B, e binary.ByteOrder) *Trie {
|
||||
|
|
|
|||
Loading…
Reference in a new issue