go-ethereum/log/format_test.go
Daniel Liu 241a5b3fb2
all: using testing.B.Loop (#1554)
* p2p: using testing.B.Loop

* core/state: using testing.B.Loop

* eth: using testing.B.Loop

* log: using testing.B.Loop

* core: using testing.B.Loop

* core/vm: using testing.B.Loop

* core/types: using testing.B.Loop

* crypto: using testing.B.Loop
2025-09-24 07:59:48 +08:00

24 lines
383 B
Go

package log
import (
"math/rand"
"testing"
)
var sink []byte
func BenchmarkPrettyInt64Logfmt(b *testing.B) {
buf := make([]byte, 100)
b.ReportAllocs()
for b.Loop() {
sink = appendInt64(buf, rand.Int63())
}
}
func BenchmarkPrettyUint64Logfmt(b *testing.B) {
buf := make([]byte, 100)
b.ReportAllocs()
for b.Loop() {
sink = appendUint64(buf, rand.Uint64(), false)
}
}