Skip to content

Commit

Permalink
add benchmark for JSONPointerToSlice cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nibbleshift committed Feb 19, 2024
1 parent 11cd7d9 commit 856d3c6
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions gabs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1950,3 +1950,37 @@ func BenchmarkWildcardSearch(b *testing.B) {
val.Search([]string{"test", "*", "value"}...)
}
}

func BenchmarkJsonPointerToSlice(b *testing.B) {
samples := []string{
"/test/field",
"/field/test",
"/user/name",
"/user/email/address",
"/host/ip/addres",
"/host/os/family",
"/host/os/version",
"/test/field",
"/field/test",
"/user/name",
"/user/email/address",
"/host/ip/addres",
"/host/os/family",
"/host/os/version",
"/test/field",
"/field/test",
"/user/name",
"/user/email/address",
"/host/ip/addres",
"/host/os/family",
"/host/os/version",
}
b.ReportAllocs()
b.ResetTimer()

for i := 0; i < b.N; i++ {
for _, s := range samples {
JSONPointerToSlice(s)

Check failure on line 1983 in gabs_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Error return value is not checked (errcheck)
}
}
}

0 comments on commit 856d3c6

Please sign in to comment.