Adjust benchmark

This commit is contained in:
Bjørn Erik Pedersen 2023-06-12 15:18:41 +02:00
parent ded6866001
commit 29e5cbb699
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -282,7 +282,14 @@ func BenchmarkAbsURL(b *testing.B) {
v.Set("baseURL", "http://base/")
p := newTestPathSpecFromCfgAndLang(v, "")
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = p.AbsURL("foo/bar", false)
}
b.Run("relurl", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = p.AbsURL("foo/bar", false)
}
})
b.Run("absurl", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = p.AbsURL("https://base/foo/bar", false)
}
})
}