Skip to content

Instantly share code, notes, and snippets.

@mediocregopher
Last active February 4, 2019 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mediocregopher/5b365a3dfedb58dfff5e7dc973dee480 to your computer and use it in GitHub Desktop.
Save mediocregopher/5b365a3dfedb58dfff5e7dc973dee480 to your computer and use it in GitHub Desktop.
this benchmark panics on arm64
package panicker
import (
"runtime"
. "testing"
"github.com/mediocregopher/radix/v3"
)
func BenchmarkPanic(b *B) {
parallel := runtime.GOMAXPROCS(0)
pool, err := radix.NewPool("tcp", "127.0.0.1:6379", parallel)
if err != nil {
b.Fatal(err)
}
defer pool.Close()
do := func(b *B, parallelism int, fn func()) {
b.ResetTimer()
b.SetParallelism(parallelism)
b.RunParallel(func(pb *PB) {
for pb.Next() {
fn()
}
})
}
b.Run("not-panicking", func(b *B) {
do(b, parallel, func() {
pool.Do(radix.Cmd(nil, "SET", "foo", "bar"))
})
})
b.Run("panicking", func(b *B) {
do(b, parallel*8, func() {
pool.Do(radix.Cmd(nil, "SET", "foo", "bar"))
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment