glob/match/segements_test.go

38 lines
565 B
Go
Raw Normal View History

2016-02-05 15:15:36 +03:00
package match
import (
"testing"
)
func BenchmarkPerfPoolSequenced(b *testing.B) {
pool := NewPoolSequenced(32, 32)
for i := 0; i < b.N; i++ {
s := pool.Get()
pool.Put(s)
}
}
func BenchmarkPerfPoolSynced(b *testing.B) {
pool := NewPoolSynced(32)
for i := 0; i < b.N; i++ {
s := pool.Get()
pool.Put(s)
}
}
func BenchmarkPerfPoolPoolNative(b *testing.B) {
pool := NewPoolNative(32)
for i := 0; i < b.N; i++ {
s := pool.Get()
pool.Put(s)
}
}
func BenchmarkPerfMake(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = make([]int, 0, 32)
}
}