1
0
mirror of https://github.com/go-kit/kit.git synced 2026-06-11 22:30:26 +02:00
Files
go-kit/sd/cache/benchmark_test.go
2016-05-26 15:37:41 -06:00

30 lines
555 B
Go

package cache
import (
"io"
"testing"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/log"
)
func BenchmarkEndpoints(b *testing.B) {
var (
ca = make(closer)
cb = make(closer)
cmap = map[string]io.Closer{"a": ca, "b": cb}
factory = func(instance string) (endpoint.Endpoint, io.Closer, error) { return endpoint.Nop, cmap[instance], nil }
c = New(factory, log.NewNopLogger())
)
b.ReportAllocs()
c.Update([]string{"a", "b"})
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
c.Endpoints()
}
})
}