github.com/tanqiangyes/govalidator@v0.0.5/utils_benchmark_test.go (about) 1 package govalidator 2 3 import "testing" 4 5 func BenchmarkContains(b *testing.B) { 6 b.ResetTimer() 7 for n := 0; n < b.N; n++ { 8 Contains("a0b01c012deffghijklmnopqrstu0123456vwxyz", "0123456789") 9 } 10 } 11 12 func BenchmarkMatches(b *testing.B) { 13 b.ResetTimer() 14 for n := 0; n < b.N; n++ { 15 Matches("alfkjl12309fdjldfsa209jlksdfjLAKJjs9uJH234", "[\\w\\d]+") 16 } 17 }