From 07f2263b41edf448797800ebbdaf2ade6efd89fe Mon Sep 17 00:00:00 2001 From: joeybloggs Date: Thu, 16 Jul 2015 08:24:27 -0400 Subject: [PATCH] Benchmark Updates Renamed for better clarity. Added Field OrTag Benchmark. --- benchmarks_test.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/benchmarks_test.go b/benchmarks_test.go index ee836c2..14c5d2b 100644 --- a/benchmarks_test.go +++ b/benchmarks_test.go @@ -2,13 +2,19 @@ package validator import "testing" -func BenchmarkValidateField(b *testing.B) { +func BenchmarkField(b *testing.B) { for n := 0; n < b.N; n++ { validate.Field("1", "len=1") } } -func BenchmarkValidateStructSimple(b *testing.B) { +func BenchmarkFieldOrTag(b *testing.B) { + for n := 0; n < b.N; n++ { + validate.Field("rgba(0,0,0,1)", "rgb|rgba") + } +} + +func BenchmarkStructSimple(b *testing.B) { type Foo struct { StringValue string `validate:"min=5,max=10"` @@ -24,7 +30,7 @@ func BenchmarkValidateStructSimple(b *testing.B) { } } -func BenchmarkTemplateParallelSimple(b *testing.B) { +func BenchmarkStructSimpleParallel(b *testing.B) { type Foo struct { StringValue string `validate:"min=5,max=10"` @@ -42,7 +48,7 @@ func BenchmarkTemplateParallelSimple(b *testing.B) { }) } -func BenchmarkValidateStructLarge(b *testing.B) { +func BenchmarkStructComplex(b *testing.B) { tFail := &TestString{ Required: "", @@ -101,7 +107,7 @@ func BenchmarkValidateStructLarge(b *testing.B) { } } -func BenchmarkTemplateParallelLarge(b *testing.B) { +func BenchmarkStructComplexParallel(b *testing.B) { tFail := &TestString{ Required: "",