Skip to content

Instantly share code, notes, and snippets.

@sugab
Last active January 22, 2021 06:50
Show Gist options
  • Save sugab/39b4363fbc3fa6d16f3bbb3f69e93b26 to your computer and use it in GitHub Desktop.
Save sugab/39b4363fbc3fa6d16f3bbb3f69e93b26 to your computer and use it in GitHub Desktop.
package main
import (
"testing"
)
func BenchmarkMovieRead(b *testing.B) {
for n := 0; n < b.N; n++ {
readJSON("movie.json", func(data map[string]interface{}) bool {
return data["year"].(float64) >= 2010
})
}
}
func BenchmarkMovieReadToken(b *testing.B) {
for n := 0; n < b.N; n++ {
readJSONToken("movie.json", func(data map[string]interface{}) bool {
return data["year"].(float64) >= 2010
})
}
}
func BenchmarkQRead(b *testing.B) {
for n := 0; n < b.N; n++ {
readJSON("question.json", func(data map[string]interface{}) bool {
return data["show_number"].(string) == "4680"
})
}
}
func BenchmarkQReadToken(b *testing.B) {
for n := 0; n < b.N; n++ {
readJSONToken("question.json", func(data map[string]interface{}) bool {
return data["show_number"].(string) == "4680"
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment