Benchmark comparer compares two go test -bench outputs and highlights what changed, by how much, and whether the difference is statistically significant - much like benchstat, right in your browser.

What you'll get
- Statistical comparison powered by the Mann-Whitney U-test, just like benchstat
- Automatic detection of statistically significant changes
- Support for -benchmem and custom b.ReportMetric() metrics
- Export the comparison to Markdown or plain text
- Everything runs locally, right in your browser
How it works
1
Run twice
Run your benchmark before and after your change
go test -bench=.
2
Copy both outputs
Copy the complete console output of each run
Include goos, goarch, pkg info
3
Compare
See what changed, by how much, and whether it matters
Export the summary to share it
Don't have two benchmark runs yet?
Run the very same benchmark twice: once before your change, once after it. For instance, try running the following test file:
package benchmark
import (
"math"
"math/rand"
"runtime"
"slices"
"testing"
)
var data []int
func init() {
const dataSize = 1000 * 1000
data = make([]int, dataSize)
for i := range data {
data[i] = rand.Int()
}
slices.Sort(data)
}
func BenchmarkSearch(b *testing.B) {
type Case struct {
Name string
Do func([]int, int)
}
cases := []Case{
{"LinearSearch", LinearSearch},
{"BinarySearch", BinarySearch},
{"JumpSearch", JumpSearch},
}
for _, c := range cases {
c := c
b.Run(c.Name, func(b *testing.B) {
b.ReportMetric(float64(len(data)), "items/count")
b.ReportMetric(float64(runtime.NumCPU()), "NumCPU")
b.SetBytes(1024*1024 + 512*1024 + 128)
b.ReportAllocs()
for i := 0; i < b.N; i++ {
target := data[rand.Intn(len(data))]
c.Do(data, target)
}
})
}
}
func LinearSearch(xs []int, x int) {
for _, y := range xs {
if x == y {
break
}
}
}
func BinarySearch(xs []int, x int) {
_, _ = slices.BinarySearch(xs, x)
}
func JumpSearch(xs []int, x int) {
n := len(xs)
if n == 0 {
return
}
step := int(math.Sqrt(float64(n)))
prev := 0
for xs[min(step, n)-1] < x {
prev = step
step += int(math.Sqrt(float64(n)))
if prev >= n {
return
}
}
for i := prev; i < min(step, n); i++ {
if xs[i] == x {
return
}
}
}Save this file as benchmark_test.go, then run it before and after your change:
$ go test -bench=. > old.txt
goos: linux
goarch: amd64
pkg: golang.org/x/perf/cmd/benchstat/testdata
BenchmarkEncode/format=json-48 690848 1726 ns/op 851 encoded_bytes/op 481 B/op 3 allocs/op
BenchmarkEncode/format=json-48 684861 1723 ns/op 847 encoded_bytes/op 475 B/op 3 allocs/op
BenchmarkEncode/format=json-48 693285 1707 ns/op 848 encoded_bytes/op 478 B/op 3 allocs/op
BenchmarkEncode/format=json-48 677692 1707 ns/op 849 encoded_bytes/op 477 B/op 3 allocs/op
BenchmarkEncode/format=json-48 692130 1713 ns/op 847 encoded_bytes/op 482 B/op 3 allocs/op
BenchmarkEncode/format=json-48 684164 1729 ns/op 848 encoded_bytes/op 482 B/op 3 allocs/op
BenchmarkEncode/format=json-48 682500 1736 ns/op 847 encoded_bytes/op 484 B/op 3 allocs/op
BenchmarkEncode/format=json-48 677509 1707 ns/op 848 encoded_bytes/op 476 B/op 3 allocs/op
BenchmarkEncode/format=json-48 687295 1705 ns/op 851 encoded_bytes/op 479 B/op 3 allocs/op
BenchmarkEncode/format=json-48 695533 1774 ns/op 849 encoded_bytes/op 475 B/op 3 allocs/op
BenchmarkEncode/format=gob-48 372699 3069 ns/op 1404 encoded_bytes/op 708 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 394740 3075 ns/op 1401 encoded_bytes/op 705 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 391335 3069 ns/op 1400 encoded_bytes/op 715 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 383588 3067 ns/op 1402 encoded_bytes/op 703 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 385885 3207 ns/op 1403 encoded_bytes/op 713 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 389970 3064 ns/op 1402 encoded_bytes/op 709 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 393361 3064 ns/op 1398 encoded_bytes/op 703 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 393882 3058 ns/op 1396 encoded_bytes/op 712 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 396171 3059 ns/op 1398 encoded_bytes/op 702 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 397812 3062 ns/op 1398 encoded_bytes/op 711 B/op 9 allocs/op$ go test -bench=. > new.txt
goos: linux
goarch: amd64
pkg: golang.org/x/perf/cmd/benchstat/testdata
BenchmarkEncode/format=json-48 714387 1423 ns/op 849 encoded_bytes/op 414 B/op 3 allocs/op
BenchmarkEncode/format=json-48 845445 1416 ns/op 848 encoded_bytes/op 416 B/op 3 allocs/op
BenchmarkEncode/format=json-48 815714 1411 ns/op 848 encoded_bytes/op 412 B/op 3 allocs/op
BenchmarkEncode/format=json-48 828824 1413 ns/op 853 encoded_bytes/op 413 B/op 3 allocs/op
BenchmarkEncode/format=json-48 834070 1412 ns/op 851 encoded_bytes/op 417 B/op 3 allocs/op
BenchmarkEncode/format=json-48 828123 1426 ns/op 851 encoded_bytes/op 416 B/op 3 allocs/op
BenchmarkEncode/format=json-48 834493 1422 ns/op 848 encoded_bytes/op 414 B/op 3 allocs/op
BenchmarkEncode/format=json-48 838406 1424 ns/op 852 encoded_bytes/op 417 B/op 3 allocs/op
BenchmarkEncode/format=json-48 836227 1447 ns/op 848 encoded_bytes/op 419 B/op 3 allocs/op
BenchmarkEncode/format=json-48 830835 1425 ns/op 849 encoded_bytes/op 412 B/op 3 allocs/op
BenchmarkEncode/format=gob-48 394441 3075 ns/op 1398 encoded_bytes/op 703 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 393207 3065 ns/op 1404 encoded_bytes/op 703 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 392374 3059 ns/op 1403 encoded_bytes/op 710 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 396037 3065 ns/op 1398 encoded_bytes/op 719 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 393255 3060 ns/op 1401 encoded_bytes/op 704 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 382629 3081 ns/op 1399 encoded_bytes/op 706 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 389558 3186 ns/op 1403 encoded_bytes/op 715 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 392668 3135 ns/op 1400 encoded_bytes/op 722 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 392313 3087 ns/op 1398 encoded_bytes/op 714 B/op 9 allocs/op
BenchmarkEncode/format=gob-48 394274 3062 ns/op 1398 encoded_bytes/op 710 B/op 9 allocs/opFor more information about Go benchmarks, please refer to the official documentation.
Paste an old and a new benchmark output (they won't be sent anywhere) and click "Compare!" to see what changed.
Old benchmark
1
New benchmark
1
We will process both benchmark outputs locally. No data will be sent to our servers.