Skip to content

Commit

Permalink
core/rawdb: fix bench
Browse files Browse the repository at this point in the history
  • Loading branch information
s1na committed Sep 7, 2021
1 parent 29aa463 commit b16ef5c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions core/rawdb/accessors_chain_test.go
Expand Up @@ -723,15 +723,21 @@ func BenchmarkDecodeRLPLogs(b *testing.B) {
b.Fatal(err)
}
b.Run("ReceiptForStorage", func(b *testing.B) {
b.ReportAllocs()
var r []*types.ReceiptForStorage
if err := rlp.DecodeBytes(buf, &r); err != nil {
b.Fatal(err)
for i := 0; i < b.N; i++ {
if err := rlp.DecodeBytes(buf, &r); err != nil {
b.Fatal(err)
}
}
})
b.Run("rlpLogs", func(b *testing.B) {
b.ReportAllocs()
var r []*receiptLogs
if err := rlp.DecodeBytes(buf, &r); err != nil {
b.Fatal(err)
for i := 0; i < b.N; i++ {
if err := rlp.DecodeBytes(buf, &r); err != nil {
b.Fatal(err)
}
}
})
}

0 comments on commit b16ef5c

Please sign in to comment.