@ -8,236 +8,197 @@ import (
)
)
func BenchmarkFieldSuccess ( b * testing . B ) {
func BenchmarkFieldSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
s := "1"
s := "1"
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( & s , "len=1" )
_ = validate . Var ( & s , "len=1" )
}
}
}
}
func BenchmarkFieldSuccessParallel ( b * testing . B ) {
func BenchmarkFieldSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
s := "1"
s := "1"
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( & s , "len=1" )
_ = validate . Var ( & s , "len=1" )
}
}
} )
} )
}
}
func BenchmarkFieldFailure ( b * testing . B ) {
func BenchmarkFieldFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
s := "12"
s := "12"
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( & s , "len=1" )
_ = validate . Var ( & s , "len=1" )
}
}
}
}
func BenchmarkFieldFailureParallel ( b * testing . B ) {
func BenchmarkFieldFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
s := "12"
s := "12"
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( & s , "len=1" )
_ = validate . Var ( & s , "len=1" )
}
}
} )
} )
}
}
func BenchmarkFieldArrayDiveSuccess ( b * testing . B ) {
func BenchmarkFieldArrayDiveSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := [ ] string { "val1" , "val2" , "val3" }
m := [ ] string { "val1" , "val2" , "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( m , "required,dive,required" )
_ = validate . Var ( m , "required,dive,required" )
}
}
}
}
func BenchmarkFieldArrayDiveSuccessParallel ( b * testing . B ) {
func BenchmarkFieldArrayDiveSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := [ ] string { "val1" , "val2" , "val3" }
m := [ ] string { "val1" , "val2" , "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( m , "required,dive,required" )
_ = validate . Var ( m , "required,dive,required" )
}
}
} )
} )
}
}
func BenchmarkFieldArrayDiveFailure ( b * testing . B ) {
func BenchmarkFieldArrayDiveFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := [ ] string { "val1" , "" , "val3" }
m := [ ] string { "val1" , "" , "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( m , "required,dive,required" )
_ = validate . Var ( m , "required,dive,required" )
}
}
}
}
func BenchmarkFieldArrayDiveFailureParallel ( b * testing . B ) {
func BenchmarkFieldArrayDiveFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := [ ] string { "val1" , "" , "val3" }
m := [ ] string { "val1" , "" , "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( m , "required,dive,required" )
_ = validate . Var ( m , "required,dive,required" )
}
}
} )
} )
}
}
func BenchmarkFieldMapDiveSuccess ( b * testing . B ) {
func BenchmarkFieldMapDiveSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := map [ string ] string { "val1" : "val1" , "val2" : "val2" , "val3" : "val3" }
m := map [ string ] string { "val1" : "val1" , "val2" : "val2" , "val3" : "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( m , "required,dive,required" )
_ = validate . Var ( m , "required,dive,required" )
}
}
}
}
func BenchmarkFieldMapDiveSuccessParallel ( b * testing . B ) {
func BenchmarkFieldMapDiveSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := map [ string ] string { "val1" : "val1" , "val2" : "val2" , "val3" : "val3" }
m := map [ string ] string { "val1" : "val1" , "val2" : "val2" , "val3" : "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( m , "required,dive,required" )
_ = validate . Var ( m , "required,dive,required" )
}
}
} )
} )
}
}
func BenchmarkFieldMapDiveFailure ( b * testing . B ) {
func BenchmarkFieldMapDiveFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := map [ string ] string { "" : "" , "val3" : "val3" }
m := map [ string ] string { "" : "" , "val3" : "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( m , "required,dive,required" )
_ = validate . Var ( m , "required,dive,required" )
}
}
}
}
func BenchmarkFieldMapDiveFailureParallel ( b * testing . B ) {
func BenchmarkFieldMapDiveFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := map [ string ] string { "" : "" , "val3" : "val3" }
m := map [ string ] string { "" : "" , "val3" : "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( m , "required,dive,required" )
_ = validate . Var ( m , "required,dive,required" )
}
}
} )
} )
}
}
func BenchmarkFieldMapDiveWithKeysSuccess ( b * testing . B ) {
func BenchmarkFieldMapDiveWithKeysSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := map [ string ] string { "val1" : "val1" , "val2" : "val2" , "val3" : "val3" }
m := map [ string ] string { "val1" : "val1" , "val2" : "val2" , "val3" : "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( m , "required,dive,keys,required,endkeys,required" )
_ = validate . Var ( m , "required,dive,keys,required,endkeys,required" )
}
}
}
}
func BenchmarkFieldMapDiveWithKeysSuccessParallel ( b * testing . B ) {
func BenchmarkFieldMapDiveWithKeysSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := map [ string ] string { "val1" : "val1" , "val2" : "val2" , "val3" : "val3" }
m := map [ string ] string { "val1" : "val1" , "val2" : "val2" , "val3" : "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( m , "required,dive,keys,required,endkeys,required" )
_ = validate . Var ( m , "required,dive,keys,required,endkeys,required" )
}
}
} )
} )
}
}
func BenchmarkFieldMapDiveWithKeysFailure ( b * testing . B ) {
func BenchmarkFieldMapDiveWithKeysFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := map [ string ] string { "" : "" , "val3" : "val3" }
m := map [ string ] string { "" : "" , "val3" : "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( m , "required,dive,keys,required,endkeys,required" )
_ = validate . Var ( m , "required,dive,keys,required,endkeys,required" )
}
}
}
}
func BenchmarkFieldMapDiveWithKeysFailureParallel ( b * testing . B ) {
func BenchmarkFieldMapDiveWithKeysFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
m := map [ string ] string { "" : "" , "val3" : "val3" }
m := map [ string ] string { "" : "" , "val3" : "val3" }
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( m , "required,dive,keys,required,endkeys,required" )
_ = validate . Var ( m , "required,dive,keys,required,endkeys,required" )
}
}
} )
} )
}
}
func BenchmarkFieldCustomTypeSuccess ( b * testing . B ) {
func BenchmarkFieldCustomTypeSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
val := valuer {
val := valuer {
Name : "1" ,
Name : "1" ,
}
}
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( val , "len=1" )
_ = validate . Var ( val , "len=1" )
}
}
}
}
func BenchmarkFieldCustomTypeSuccessParallel ( b * testing . B ) {
func BenchmarkFieldCustomTypeSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
val := valuer {
val := valuer {
Name : "1" ,
Name : "1" ,
}
}
@ -245,111 +206,95 @@ func BenchmarkFieldCustomTypeSuccessParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( val , "len=1" )
_ = validate . Var ( val , "len=1" )
}
}
} )
} )
}
}
func BenchmarkFieldCustomTypeFailure ( b * testing . B ) {
func BenchmarkFieldCustomTypeFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
val := valuer { }
val := valuer { }
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( val , "len=1" )
_ = validate . Var ( val , "len=1" )
}
}
}
}
func BenchmarkFieldCustomTypeFailureParallel ( b * testing . B ) {
func BenchmarkFieldCustomTypeFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
val := valuer { }
val := valuer { }
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( val , "len=1" )
_ = validate . Var ( val , "len=1" )
}
}
} )
} )
}
}
func BenchmarkFieldOrTagSuccess ( b * testing . B ) {
func BenchmarkFieldOrTagSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
s := "rgba(0,0,0,1)"
s := "rgba(0,0,0,1)"
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( s , "rgb|rgba" )
_ = validate . Var ( s , "rgb|rgba" )
}
}
}
}
func BenchmarkFieldOrTagSuccessParallel ( b * testing . B ) {
func BenchmarkFieldOrTagSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
s := "rgba(0,0,0,1)"
s := "rgba(0,0,0,1)"
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( s , "rgb|rgba" )
_ = validate . Var ( s , "rgb|rgba" )
}
}
} )
} )
}
}
func BenchmarkFieldOrTagFailure ( b * testing . B ) {
func BenchmarkFieldOrTagFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
s := "#000"
s := "#000"
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Var ( s , "rgb|rgba" )
_ = validate . Var ( s , "rgb|rgba" )
}
}
}
}
func BenchmarkFieldOrTagFailureParallel ( b * testing . B ) {
func BenchmarkFieldOrTagFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
s := "#000"
s := "#000"
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Var ( s , "rgb|rgba" )
_ = validate . Var ( s , "rgb|rgba" )
}
}
} )
} )
}
}
func BenchmarkStructLevelValidationSuccess ( b * testing . B ) {
func BenchmarkStructLevelValidationSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterStructValidation ( StructValidationTestStructSuccess , TestStruct { } )
validate . RegisterStructValidation ( StructValidationTestStructSuccess , TestStruct { } )
tst := TestStruct {
tst := TestStruct {
String : "good value" ,
String : "good value" ,
}
}
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( tst )
_ = validate . Struct ( tst )
}
}
}
}
func BenchmarkStructLevelValidationSuccessParallel ( b * testing . B ) {
func BenchmarkStructLevelValidationSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterStructValidation ( StructValidationTestStructSuccess , TestStruct { } )
validate . RegisterStructValidation ( StructValidationTestStructSuccess , TestStruct { } )
tst := TestStruct {
tst := TestStruct {
String : "good value" ,
String : "good value" ,
}
}
@ -357,31 +302,27 @@ func BenchmarkStructLevelValidationSuccessParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( tst )
_ = validate . Struct ( tst )
}
}
} )
} )
}
}
func BenchmarkStructLevelValidationFailure ( b * testing . B ) {
func BenchmarkStructLevelValidationFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterStructValidation ( StructValidationTestStruct , TestStruct { } )
validate . RegisterStructValidation ( StructValidationTestStruct , TestStruct { } )
tst := TestStruct {
tst := TestStruct {
String : "good value" ,
String : "good value" ,
}
}
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( tst )
_ = validate . Struct ( tst )
}
}
}
}
func BenchmarkStructLevelValidationFailureParallel ( b * testing . B ) {
func BenchmarkStructLevelValidationFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterStructValidation ( StructValidationTestStruct , TestStruct { } )
validate . RegisterStructValidation ( StructValidationTestStruct , TestStruct { } )
tst := TestStruct {
tst := TestStruct {
String : "good value" ,
String : "good value" ,
}
}
@ -389,13 +330,12 @@ func BenchmarkStructLevelValidationFailureParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( tst )
_ = validate . Struct ( tst )
}
}
} )
} )
}
}
func BenchmarkStructSimpleCustomTypeSuccess ( b * testing . B ) {
func BenchmarkStructSimpleCustomTypeSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
@ -412,12 +352,11 @@ func BenchmarkStructSimpleCustomTypeSuccess(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( validFoo )
_ = validate . Struct ( validFoo )
}
}
}
}
func BenchmarkStructSimpleCustomTypeSuccessParallel ( b * testing . B ) {
func BenchmarkStructSimpleCustomTypeSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
@ -435,13 +374,12 @@ func BenchmarkStructSimpleCustomTypeSuccessParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( validFoo )
_ = validate . Struct ( validFoo )
}
}
} )
} )
}
}
func BenchmarkStructSimpleCustomTypeFailure ( b * testing . B ) {
func BenchmarkStructSimpleCustomTypeFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
@ -456,12 +394,11 @@ func BenchmarkStructSimpleCustomTypeFailure(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( validFoo )
_ = validate . Struct ( validFoo )
}
}
}
}
func BenchmarkStructSimpleCustomTypeFailureParallel ( b * testing . B ) {
func BenchmarkStructSimpleCustomTypeFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
validate . RegisterCustomTypeFunc ( ValidateValuerType , ( * sql . Valuer ) ( nil ) , valuer { } )
@ -477,13 +414,12 @@ func BenchmarkStructSimpleCustomTypeFailureParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( validate . Struct ( validFoo ) )
_ = validate . Struct ( validate . Struct ( validFoo ) )
}
}
} )
} )
}
}
func BenchmarkStructFilteredSuccess ( b * testing . B ) {
func BenchmarkStructFilteredSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -503,12 +439,11 @@ func BenchmarkStructFilteredSuccess(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . StructFiltered ( test , fn )
_ = validate . StructFiltered ( test , fn )
}
}
}
}
func BenchmarkStructFilteredSuccessParallel ( b * testing . B ) {
func BenchmarkStructFilteredSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -529,13 +464,12 @@ func BenchmarkStructFilteredSuccessParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . StructFiltered ( test , fn )
_ = validate . StructFiltered ( test , fn )
}
}
} )
} )
}
}
func BenchmarkStructFilteredFailure ( b * testing . B ) {
func BenchmarkStructFilteredFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -555,12 +489,11 @@ func BenchmarkStructFilteredFailure(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . StructFiltered ( test , fn )
_ = validate . StructFiltered ( test , fn )
}
}
}
}
func BenchmarkStructFilteredFailureParallel ( b * testing . B ) {
func BenchmarkStructFilteredFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -581,13 +514,12 @@ func BenchmarkStructFilteredFailureParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . StructFiltered ( test , fn )
_ = validate . StructFiltered ( test , fn )
}
}
} )
} )
}
}
func BenchmarkStructPartialSuccess ( b * testing . B ) {
func BenchmarkStructPartialSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -601,12 +533,11 @@ func BenchmarkStructPartialSuccess(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . StructPartial ( test , "Name" )
_ = validate . StructPartial ( test , "Name" )
}
}
}
}
func BenchmarkStructPartialSuccessParallel ( b * testing . B ) {
func BenchmarkStructPartialSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -621,13 +552,12 @@ func BenchmarkStructPartialSuccessParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . StructPartial ( test , "Name" )
_ = validate . StructPartial ( test , "Name" )
}
}
} )
} )
}
}
func BenchmarkStructPartialFailure ( b * testing . B ) {
func BenchmarkStructPartialFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -641,12 +571,11 @@ func BenchmarkStructPartialFailure(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . StructPartial ( test , "NickName" )
_ = validate . StructPartial ( test , "NickName" )
}
}
}
}
func BenchmarkStructPartialFailureParallel ( b * testing . B ) {
func BenchmarkStructPartialFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -661,13 +590,12 @@ func BenchmarkStructPartialFailureParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . StructPartial ( test , "NickName" )
_ = validate . StructPartial ( test , "NickName" )
}
}
} )
} )
}
}
func BenchmarkStructExceptSuccess ( b * testing . B ) {
func BenchmarkStructExceptSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -681,12 +609,11 @@ func BenchmarkStructExceptSuccess(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . StructExcept ( test , "Nickname" )
_ = validate . StructExcept ( test , "Nickname" )
}
}
}
}
func BenchmarkStructExceptSuccessParallel ( b * testing . B ) {
func BenchmarkStructExceptSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -701,13 +628,12 @@ func BenchmarkStructExceptSuccessParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . StructExcept ( test , "NickName" )
_ = validate . StructExcept ( test , "NickName" )
}
}
} )
} )
}
}
func BenchmarkStructExceptFailure ( b * testing . B ) {
func BenchmarkStructExceptFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -721,12 +647,11 @@ func BenchmarkStructExceptFailure(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . StructExcept ( test , "Name" )
_ = validate . StructExcept ( test , "Name" )
}
}
}
}
func BenchmarkStructExceptFailureParallel ( b * testing . B ) {
func BenchmarkStructExceptFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -741,13 +666,12 @@ func BenchmarkStructExceptFailureParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . StructExcept ( test , "Name" )
_ = validate . StructExcept ( test , "Name" )
}
}
} )
} )
}
}
func BenchmarkStructSimpleCrossFieldSuccess ( b * testing . B ) {
func BenchmarkStructSimpleCrossFieldSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -765,12 +689,11 @@ func BenchmarkStructSimpleCrossFieldSuccess(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( test )
_ = validate . Struct ( test )
}
}
}
}
func BenchmarkStructSimpleCrossFieldSuccessParallel ( b * testing . B ) {
func BenchmarkStructSimpleCrossFieldSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -789,13 +712,12 @@ func BenchmarkStructSimpleCrossFieldSuccessParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( test )
_ = validate . Struct ( test )
}
}
} )
} )
}
}
func BenchmarkStructSimpleCrossFieldFailure ( b * testing . B ) {
func BenchmarkStructSimpleCrossFieldFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -813,12 +735,11 @@ func BenchmarkStructSimpleCrossFieldFailure(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( test )
_ = validate . Struct ( test )
}
}
}
}
func BenchmarkStructSimpleCrossFieldFailureParallel ( b * testing . B ) {
func BenchmarkStructSimpleCrossFieldFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Test struct {
type Test struct {
@ -836,13 +757,12 @@ func BenchmarkStructSimpleCrossFieldFailureParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( test )
_ = validate . Struct ( test )
}
}
} )
} )
}
}
func BenchmarkStructSimpleCrossStructCrossFieldSuccess ( b * testing . B ) {
func BenchmarkStructSimpleCrossStructCrossFieldSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Inner struct {
type Inner struct {
@ -867,12 +787,11 @@ func BenchmarkStructSimpleCrossStructCrossFieldSuccess(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( outer )
_ = validate . Struct ( outer )
}
}
}
}
func BenchmarkStructSimpleCrossStructCrossFieldSuccessParallel ( b * testing . B ) {
func BenchmarkStructSimpleCrossStructCrossFieldSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Inner struct {
type Inner struct {
@ -898,13 +817,12 @@ func BenchmarkStructSimpleCrossStructCrossFieldSuccessParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( outer )
_ = validate . Struct ( outer )
}
}
} )
} )
}
}
func BenchmarkStructSimpleCrossStructCrossFieldFailure ( b * testing . B ) {
func BenchmarkStructSimpleCrossStructCrossFieldFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Inner struct {
type Inner struct {
@ -930,12 +848,11 @@ func BenchmarkStructSimpleCrossStructCrossFieldFailure(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( outer )
_ = validate . Struct ( outer )
}
}
}
}
func BenchmarkStructSimpleCrossStructCrossFieldFailureParallel ( b * testing . B ) {
func BenchmarkStructSimpleCrossStructCrossFieldFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Inner struct {
type Inner struct {
@ -962,13 +879,12 @@ func BenchmarkStructSimpleCrossStructCrossFieldFailureParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( outer )
_ = validate . Struct ( outer )
}
}
} )
} )
}
}
func BenchmarkStructSimpleSuccess ( b * testing . B ) {
func BenchmarkStructSimpleSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Foo struct {
type Foo struct {
@ -980,12 +896,11 @@ func BenchmarkStructSimpleSuccess(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( validFoo )
_ = validate . Struct ( validFoo )
}
}
}
}
func BenchmarkStructSimpleSuccessParallel ( b * testing . B ) {
func BenchmarkStructSimpleSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Foo struct {
type Foo struct {
@ -998,13 +913,12 @@ func BenchmarkStructSimpleSuccessParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( validFoo )
_ = validate . Struct ( validFoo )
}
}
} )
} )
}
}
func BenchmarkStructSimpleFailure ( b * testing . B ) {
func BenchmarkStructSimpleFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Foo struct {
type Foo struct {
@ -1016,12 +930,11 @@ func BenchmarkStructSimpleFailure(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( invalidFoo )
_ = validate . Struct ( invalidFoo )
}
}
}
}
func BenchmarkStructSimpleFailureParallel ( b * testing . B ) {
func BenchmarkStructSimpleFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
type Foo struct {
type Foo struct {
@ -1034,13 +947,12 @@ func BenchmarkStructSimpleFailureParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( invalidFoo )
_ = validate . Struct ( invalidFoo )
}
}
} )
} )
}
}
func BenchmarkStructComplexSuccess ( b * testing . B ) {
func BenchmarkStructComplexSuccess ( b * testing . B ) {
validate := New ( )
validate := New ( )
tSuccess := & TestString {
tSuccess := & TestString {
@ -1072,12 +984,11 @@ func BenchmarkStructComplexSuccess(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( tSuccess )
_ = validate . Struct ( tSuccess )
}
}
}
}
func BenchmarkStructComplexSuccessParallel ( b * testing . B ) {
func BenchmarkStructComplexSuccessParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
tSuccess := & TestString {
tSuccess := & TestString {
@ -1110,13 +1021,12 @@ func BenchmarkStructComplexSuccessParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( tSuccess )
_ = validate . Struct ( tSuccess )
}
}
} )
} )
}
}
func BenchmarkStructComplexFailure ( b * testing . B ) {
func BenchmarkStructComplexFailure ( b * testing . B ) {
validate := New ( )
validate := New ( )
tFail := & TestString {
tFail := & TestString {
@ -1145,12 +1055,11 @@ func BenchmarkStructComplexFailure(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
for n := 0 ; n < b . N ; n ++ {
for n := 0 ; n < b . N ; n ++ {
validate . Struct ( tFail )
_ = validate . Struct ( tFail )
}
}
}
}
func BenchmarkStructComplexFailureParallel ( b * testing . B ) {
func BenchmarkStructComplexFailureParallel ( b * testing . B ) {
validate := New ( )
validate := New ( )
tFail := & TestString {
tFail := & TestString {
@ -1180,7 +1089,7 @@ func BenchmarkStructComplexFailureParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
validate . Struct ( tFail )
_ = validate . Struct ( tFail )
}
}
} )
} )
}
}
@ -1193,7 +1102,7 @@ func BenchmarkOneof(b *testing.B) {
w := & TestOneof { Color : "green" }
w := & TestOneof { Color : "green" }
val := New ( )
val := New ( )
for i := 0 ; i < b . N ; i ++ {
for i := 0 ; i < b . N ; i ++ {
val . Struct ( w )
_ = val . Struct ( w )
}
}
}
}
@ -1204,7 +1113,7 @@ func BenchmarkOneofParallel(b *testing.B) {
b . ResetTimer ( )
b . ResetTimer ( )
b . RunParallel ( func ( pb * testing . PB ) {
b . RunParallel ( func ( pb * testing . PB ) {
for pb . Next ( ) {
for pb . Next ( ) {
val . Struct ( w )
_ = val . Struct ( w )
}
}
} )
} )
}
}