Last active
February 4, 2019 19:53
-
-
Save mediocregopher/5b365a3dfedb58dfff5e7dc973dee480 to your computer and use it in GitHub Desktop.
this benchmark panics on arm64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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