Skip to content

Commit

Permalink
Add benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Jan 8, 2024
1 parent b023ebc commit d57436a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/endpoints/endponts_bench_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package endpoints

import (
"context"
"testing"
)

func BenchmarkEndpointGroup(b *testing.B) {
e := newEndpointGroup()
e.setIPs(map[string]struct{}{"10.0.0.1": {}}, map[string]int32{"testPort": 1})
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
_, err := e.getBestHost(context.Background(), "testPort")
if err != nil {
b.Fatal(err)
}
}
})
}

0 comments on commit d57436a

Please sign in to comment.