orchestrator/geoip: add a benchmark for Iterate*Databases()

Now:

```
goos: linux
goarch: amd64
pkg: akvorado/orchestrator/geoip
cpu: AMD Ryzen 7 PRO 6850U with Radeon Graphics
BenchmarkIterDatabase/ASN-16                3376               457.0 ns/entry
BenchmarkIterDatabase/GeoIP-16              2410               754.5 ns/entry
```

Before 0a10764cc9:

```
goos: linux
goarch: amd64
pkg: akvorado/orchestrator/geoip
cpu: AMD Ryzen 7 PRO 6850U with Radeon Graphics
BenchmarkIterDatabase/ASN-16                2863               609.3 ns/entry
BenchmarkIterDatabase/GeoIP-16              3286               719.3 ns/entry
```

I was hoping for a bit more!
This commit is contained in:
Vincent Bernat
2025-08-17 08:43:59 +02:00
parent 2c8161e946
commit 6b2af58a64
4 changed files with 32 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ type MockComponent struct {
}
// NewMock will create a daemon component that does nothing.
func NewMock(t *testing.T) Component {
func NewMock(t testing.TB) Component {
t.Helper()
return &MockComponent{
lifecycleComponent: lifecycleComponent{

View File

@@ -103,7 +103,7 @@ func CheckExternalService(t *testing.T, name string, candidates []string) string
}
// StartStop starts a component and stops it on cleanup.
func StartStop(t *testing.T, component any) {
func StartStop(t testing.TB, component any) {
t.Helper()
if starterC, ok := component.(starter); ok {
if err := starterC.Start(); err != nil {