Last active
January 22, 2021 06:50
-
-
Save sugab/39b4363fbc3fa6d16f3bbb3f69e93b26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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