mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 07:37:20 +00:00
before: go test -run=^$ -bench=. ./log -timeout=1h 12.19s user 2.19s system 89% cpu 16.025 total after: go test -run=^$ -bench=. ./log -timeout=1h 10.64s user 1.53s system 89% cpu 13.607 total --------- Co-authored-by: lightclient <lightclient@protonmail.com>
24 lines
383 B
Go
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)
|
|
}
|
|
}
|