Created
July 15, 2017 15:33
-
-
Save yu81/2bdc50813d7093b3867a9d690daa669c 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
// go 1.7.4 以下のベンチマークコードで go test -v -bench -benchmem を実行 | |
func BenchmarkMatchFooBarBaz(b *testing.B) { | |
r := regexp.MustCompile("^foo") | |
const input = "foo" | |
b.ResetTimer() | |
for i := 0; i < b.N; i++ { | |
r.MatchString(input) | |
} | |
} | |
// -> BenchmarkMatchFoo-4 10000000 230 ns/op 0 B/op 0 allocs/op |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment