gatus/storage/store/memory/util_bench_test.go

22 lines
555 B
Go
Raw Normal View History

package memory
import (
"testing"
"github.com/TwiN/gatus/v5/config/endpoint"
2022-12-06 07:41:09 +01:00
"github.com/TwiN/gatus/v5/storage/store/common"
"github.com/TwiN/gatus/v5/storage/store/common/paging"
)
func BenchmarkShallowCopyEndpointStatus(b *testing.B) {
ep := &testEndpoint
status := endpoint.NewStatus(ep.Group, ep.Name)
2021-08-13 03:54:23 +02:00
for i := 0; i < common.MaximumNumberOfResults; i++ {
AddResult(status, &testSuccessfulResult)
}
for n := 0; n < b.N; n++ {
ShallowCopyEndpointStatus(status, paging.NewEndpointStatusParams().WithResults(1, 20))
}
b.ReportAllocs()
}