mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
triedb/pathdb: add BenchmarkBlockWriterAppend
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
f37fe6750f
commit
34278a7509
1 changed files with 19 additions and 0 deletions
|
|
@ -232,3 +232,22 @@ func BenchmarkParseIndexBlock(b *testing.B) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BenchmarkBlockWriterAppend benchmarks the performance of indexblock.writer
|
||||||
|
func BenchmarkBlockWriterAppend(b *testing.B) {
|
||||||
|
b.ReportAllocs()
|
||||||
|
b.ResetTimer()
|
||||||
|
|
||||||
|
desc := newIndexBlockDesc(0)
|
||||||
|
writer, _ := newBlockWriter(nil, desc)
|
||||||
|
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
if writer.full() {
|
||||||
|
desc = newIndexBlockDesc(0)
|
||||||
|
writer, _ = newBlockWriter(nil, desc)
|
||||||
|
}
|
||||||
|
if err := writer.append(writer.desc.max + 1); err != nil {
|
||||||
|
b.Error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue