joeybloggs
89d5a94084
final touches + README updates
...
fresh test of old vs new benchmarks
```go
benchmark old ns/op new ns/op delta
BenchmarkFieldSuccess-8 155 118 -23.87%
BenchmarkFieldFailure-8 777 758 -2.45%
BenchmarkFieldDiveSuccess-8 2813 2471 -12.16%
BenchmarkFieldDiveFailure-8 3544 3172 -10.50%
BenchmarkFieldCustomTypeSuccess-8 328 300 -8.54%
BenchmarkFieldCustomTypeFailure-8 748 775 +3.61%
BenchmarkFieldOrTagSuccess-8 1169 1122 -4.02%
BenchmarkFieldOrTagFailure-8 1205 1167 -3.15%
BenchmarkStructLevelValidationSuccess-8 670 548 -18.21%
BenchmarkStructLevelValidationFailure-8 1380 558 -59.57%
BenchmarkStructSimpleCustomTypeSuccess-8 889 623 -29.92%
BenchmarkStructSimpleCustomTypeFailure-8 1536 1381 -10.09%
BenchmarkStructPartialSuccess-8 1194 1036 -13.23%
BenchmarkStructPartialFailure-8 1869 1734 -7.22%
BenchmarkStructExceptSuccess-8 949 888 -6.43%
BenchmarkStructExceptFailure-8 1181 1036 -12.28%
BenchmarkStructSimpleCrossFieldSuccess-8 948 773 -18.46%
BenchmarkStructSimpleCrossFieldFailure-8 1708 1487 -12.94%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-8 1608 1261 -21.58%
BenchmarkStructSimpleCrossStructCrossFieldFailure-8 2320 2055 -11.42%
BenchmarkStructSimpleSuccess-8 833 519 -37.70%
BenchmarkStructSimpleFailure-8 1612 1429 -11.35%
BenchmarkStructSimpleSuccessParallel-8 239 146 -38.91%
BenchmarkStructSimpleFailureParallel-8 664 551 -17.02%
BenchmarkStructComplexSuccess-8 5025 3269 -34.95%
BenchmarkStructComplexFailure-8 10166 8436 -17.02%
BenchmarkStructComplexSuccessParallel-8 1591 1024 -35.64%
BenchmarkStructComplexFailureParallel-8 4306 3536 -17.88%
benchmark old allocs new allocs delta
BenchmarkFieldSuccess-8 0 0 +0.00%
BenchmarkFieldFailure-8 4 4 +0.00%
BenchmarkFieldDiveSuccess-8 27 28 +3.70%
BenchmarkFieldDiveFailure-8 31 32 +3.23%
BenchmarkFieldCustomTypeSuccess-8 2 2 +0.00%
BenchmarkFieldCustomTypeFailure-8 4 4 +0.00%
BenchmarkFieldOrTagSuccess-8 1 1 +0.00%
BenchmarkFieldOrTagFailure-8 6 6 +0.00%
BenchmarkStructLevelValidationSuccess-8 6 5 -16.67%
BenchmarkStructLevelValidationFailure-8 11 5 -54.55%
BenchmarkStructSimpleCustomTypeSuccess-8 5 3 -40.00%
BenchmarkStructSimpleCustomTypeFailure-8 11 9 -18.18%
BenchmarkStructPartialSuccess-8 10 9 -10.00%
BenchmarkStructPartialFailure-8 15 14 -6.67%
BenchmarkStructExceptSuccess-8 7 7 +0.00%
BenchmarkStructExceptFailure-8 10 9 -10.00%
BenchmarkStructSimpleCrossFieldSuccess-8 6 4 -33.33%
BenchmarkStructSimpleCrossFieldFailure-8 11 9 -18.18%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-8 10 7 -30.00%
BenchmarkStructSimpleCrossStructCrossFieldFailure-8 15 12 -20.00%
BenchmarkStructSimpleSuccess-8 3 1 -66.67%
BenchmarkStructSimpleFailure-8 11 9 -18.18%
BenchmarkStructSimpleSuccessParallel-8 3 1 -66.67%
BenchmarkStructSimpleFailureParallel-8 11 9 -18.18%
BenchmarkStructComplexSuccess-8 32 15 -53.12%
BenchmarkStructComplexFailure-8 77 60 -22.08%
BenchmarkStructComplexSuccessParallel-8 32 15 -53.12%
BenchmarkStructComplexFailureParallel-8 77 60 -22.08%
benchmark old bytes new bytes delta
BenchmarkFieldSuccess-8 0 0 +0.00%
BenchmarkFieldFailure-8 432 432 +0.00%
BenchmarkFieldDiveSuccess-8 384 464 +20.83%
BenchmarkFieldDiveFailure-8 816 896 +9.80%
BenchmarkFieldCustomTypeSuccess-8 32 32 +0.00%
BenchmarkFieldCustomTypeFailure-8 432 432 +0.00%
BenchmarkFieldOrTagSuccess-8 4 4 +0.00%
BenchmarkFieldOrTagFailure-8 448 448 +0.00%
BenchmarkStructLevelValidationSuccess-8 168 160 -4.76%
BenchmarkStructLevelValidationFailure-8 632 160 -74.68%
BenchmarkStructSimpleCustomTypeSuccess-8 56 36 -35.71%
BenchmarkStructSimpleCustomTypeFailure-8 656 640 -2.44%
BenchmarkStructPartialSuccess-8 352 272 -22.73%
BenchmarkStructPartialFailure-8 808 730 -9.65%
BenchmarkStructExceptSuccess-8 314 250 -20.38%
BenchmarkStructExceptFailure-8 352 272 -22.73%
BenchmarkStructSimpleCrossFieldSuccess-8 96 80 -16.67%
BenchmarkStructSimpleCrossFieldFailure-8 552 536 -2.90%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-8 136 112 -17.65%
BenchmarkStructSimpleCrossStructCrossFieldFailure-8 600 576 -4.00%
BenchmarkStructSimpleSuccess-8 24 4 -83.33%
BenchmarkStructSimpleFailure-8 656 640 -2.44%
BenchmarkStructSimpleSuccessParallel-8 24 4 -83.33%
BenchmarkStructSimpleFailureParallel-8 656 640 -2.44%
BenchmarkStructComplexSuccess-8 392 244 -37.76%
BenchmarkStructComplexFailure-8 3745 3609 -3.63%
BenchmarkStructComplexSuccessParallel-8 392 244 -37.76%
BenchmarkStructComplexFailureParallel-8 3745 3609 -3.63%
```
8 years ago
joeybloggs
80301d1184
fix go report card badge.
8 years ago
joeybloggs
7a080ada5b
Fix issue with omitempty combined with nullable types in combination with a default static value set as the value
...
fix for issue-#249
8 years ago
joeybloggs
014792cf3e
Update README version
9 years ago
Dean Karn
1214d3629c
Update README.md
9 years ago
joeybloggs
f38559b489
Update checking unexpected fields for Go 1.6 https://tip.golang.org/doc/go1.6#reflect
...
* I have not run into the issue yet, but being preemptive
9 years ago
Dean Karn
73aaa89512
Update README.md
9 years ago
joeybloggs
64b7e2bb79
correct CI links
9 years ago
joeybloggs
50ada8d03a
Add Complimentary software section README
9 years ago
joeybloggs
0862513fbf
Add some string check optimizations
...
* was using len(string) for some blank checks instead of string == ""
9 years ago
joeybloggs
afbcf59553
Add FieldNamespace and NameNamespace
...
* Add FieldNamespace and NameNamespace to FieldError. This allows for having the CustomName i.e. JSON namespace contained within the NameNamespace which would be very useful when using a more restful API approach.
9 years ago
Anthony Olurin
c4d5999ec0
Added logo to ReadMe
9 years ago
joeybloggs
e019c28542
Add struct field + associated tags caching
...
* This essentially reduces the number of cache tag lookups for a structs fields to one.
9 years ago
joeybloggs
b0bd08d7c8
Micro optimization in Tag Cache
...
Removed defer from the simple Tag Cache lock & unlock and reduced
execution time for even single field validation by almost 100ns
from 254ns/op to 163ns/op .. Not badd for such a simple modification
and this effect ripples throughout struct validation.
```go
$ go test -cpu=4 -bench=. -benchmem=true
PASS
BenchmarkFieldSuccess-4 10000000 163 ns/op 0 B/op 0 allocs/op
BenchmarkFieldFailure-4 2000000 673 ns/op 400 B/op 4 allocs/op
BenchmarkFieldDiveSuccess-4 500000 3019 ns/op 480 B/op 27 allocs/op
BenchmarkFieldDiveFailure-4 500000 3553 ns/op 880 B/op 31 allocs/op
BenchmarkFieldCustomTypeSuccess-4 5000000 347 ns/op 32 B/op 2 allocs/op
BenchmarkFieldCustomTypeFailure-4 2000000 645 ns/op 400 B/op 4 allocs/op
BenchmarkFieldOrTagSuccess-4 1000000 1177 ns/op 16 B/op 1 allocs/op
BenchmarkFieldOrTagFailure-4 1000000 1093 ns/op 432 B/op 6 allocs/op
BenchmarkStructLevelValidationSuccess-4 2000000 702 ns/op 160 B/op 6 allocs/op
BenchmarkStructLevelValidationFailure-4 1000000 1279 ns/op 592 B/op 11 allocs/op
BenchmarkStructSimpleCustomTypeSuccess-4 1000000 1010 ns/op 80 B/op 5 allocs/op
BenchmarkStructSimpleCustomTypeFailure-4 1000000 1544 ns/op 624 B/op 11 allocs/op
BenchmarkStructPartialSuccess-4 1000000 1249 ns/op 400 B/op 11 allocs/op
BenchmarkStructPartialFailure-4 1000000 1797 ns/op 816 B/op 16 allocs/op
BenchmarkStructExceptSuccess-4 2000000 927 ns/op 368 B/op 9 allocs/op
BenchmarkStructExceptFailure-4 1000000 1259 ns/op 400 B/op 11 allocs/op
BenchmarkStructSimpleCrossFieldSuccess-4 1000000 1076 ns/op 128 B/op 6 allocs/op
BenchmarkStructSimpleCrossFieldFailure-4 1000000 1623 ns/op 560 B/op 11 allocs/op
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4 1000000 1582 ns/op 176 B/op 9 allocs/op
BenchmarkStructSimpleCrossStructCrossFieldFailure-4 1000000 2139 ns/op 608 B/op 14 allocs/op
BenchmarkStructSimpleSuccess-4 1000000 1040 ns/op 48 B/op 3 allocs/op
BenchmarkStructSimpleFailure-4 1000000 1683 ns/op 624 B/op 11 allocs/op
BenchmarkStructSimpleSuccessParallel-4 5000000 356 ns/op 48 B/op 3 allocs/op
BenchmarkStructSimpleFailureParallel-4 2000000 831 ns/op 624 B/op 11 allocs/op
BenchmarkStructComplexSuccess-4 200000 6738 ns/op 512 B/op 30 allocs/op
BenchmarkStructComplexFailure-4 200000 11387 ns/op 3415 B/op 72 allocs/op
BenchmarkStructComplexSuccessParallel-4 500000 2330 ns/op 512 B/op 30 allocs/op
BenchmarkStructComplexFailureParallel-4 300000 4857 ns/op 3416 B/op 72 allocs/op
```
```go
$ go test -cpu=4 -bench=. -benchmem=true
PASS
BenchmarkFieldSuccess-4 5000000 254 ns/op 0 B/op 0 allocs/op
BenchmarkFieldFailure-4 2000000 779 ns/op 400 B/op 4 allocs/op
BenchmarkFieldDiveSuccess-4 500000 3451 ns/op 480 B/op 27 allocs/op
BenchmarkFieldDiveFailure-4 300000 3954 ns/op 880 B/op 31 allocs/op
BenchmarkFieldCustomTypeSuccess-4 3000000 451 ns/op 32 B/op 2 allocs/op
BenchmarkFieldCustomTypeFailure-4 2000000 751 ns/op 400 B/op 4 allocs/op
BenchmarkFieldOrTagSuccess-4 1000000 1312 ns/op 16 B/op 1 allocs/op
BenchmarkFieldOrTagFailure-4 1000000 1206 ns/op 432 B/op 6 allocs/op
BenchmarkStructLevelValidationSuccess-4 2000000 829 ns/op 160 B/op 6 allocs/op
BenchmarkStructLevelValidationFailure-4 1000000 1403 ns/op 592 B/op 11 allocs/op
BenchmarkStructSimpleCustomTypeSuccess-4 1000000 1238 ns/op 80 B/op 5 allocs/op
BenchmarkStructSimpleCustomTypeFailure-4 1000000 1771 ns/op 624 B/op 11 allocs/op
BenchmarkStructPartialSuccess-4 1000000 1399 ns/op 400 B/op 11 allocs/op
BenchmarkStructPartialFailure-4 1000000 1926 ns/op 816 B/op 16 allocs/op
BenchmarkStructExceptSuccess-4 2000000 930 ns/op 368 B/op 9 allocs/op
BenchmarkStructExceptFailure-4 1000000 1381 ns/op 400 B/op 11 allocs/op
BenchmarkStructSimpleCrossFieldSuccess-4 1000000 1253 ns/op 128 B/op 6 allocs/op
BenchmarkStructSimpleCrossFieldFailure-4 1000000 1849 ns/op 560 B/op 11 allocs/op
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4 1000000 1902 ns/op 176 B/op 9 allocs/op
BenchmarkStructSimpleCrossStructCrossFieldFailure-4 500000 2453 ns/op 608 B/op 14 allocs/op
BenchmarkStructSimpleSuccess-4 1000000 1182 ns/op 48 B/op 3 allocs/op
BenchmarkStructSimpleFailure-4 1000000 1842 ns/op 624 B/op 11 allocs/op
BenchmarkStructSimpleSuccessParallel-4 5000000 342 ns/op 48 B/op 3 allocs/op
BenchmarkStructSimpleFailureParallel-4 2000000 665 ns/op 624 B/op 11 allocs/op
BenchmarkStructComplexSuccess-4 200000 7924 ns/op 512 B/op 30 allocs/op
BenchmarkStructComplexFailure-4 100000 12605 ns/op 3415 B/op 72 allocs/op
BenchmarkStructComplexSuccessParallel-4 1000000 2421 ns/op 512 B/op 30 allocs/op
BenchmarkStructComplexFailureParallel-4 300000 4234 ns/op 3416 B/op 72 allocs/op
```
9 years ago
joeybloggs
d451d57023
Update benchmarks + correct benchmark error
...
* Fix error with BenchmarkFieldFailure, it was recording a successful
run.
* Update some benchmarks, they were showing allocations for the creation
of the data not just processing it.
9 years ago
joeybloggs
59859969c6
Fix issue with structOnly + struct level validation
...
* Issue was that when "structonly" tag was set the struct
level validation wasn't running, this has been corrected.
9 years ago
joeybloggs
f1acffdfe0
Add Struct Level Validation!
9 years ago
Dean Karn
11b132ba0b
Update README.md
...
Add goreport badge
9 years ago
Fábio Gomes
28b6964c53
Fix typo on README so the example compiles
9 years ago
joeybloggs
46f4476335
Update README
9 years ago
joeybloggs
36c0f0aa99
Update for repo move
...
* moved from bluesuncorp org to go-playground org
9 years ago
Dean Karn
ec1066576d
Update README.md
...
Update CI and coverage badges for v8 branch
9 years ago
joeybloggs
eab946fcd9
update CI and coverage badger to v8-development
9 years ago
joeybloggs
d5f9115ad5
update all example references to v8
9 years ago
joeybloggs
aa72515d75
update benchmarks
9 years ago
joeybloggs
b366564cbe
update to v8 benchmarks
9 years ago
Joel Williams
715aa553c8
Added checking for nil receiver on Validator methods
9 years ago
joeybloggs
22a5f70a0e
Add Error handling info to README
9 years ago
joeybloggs
19b2f07d98
Update README for v8
9 years ago
joeybloggs
b213226b01
Add Alias to the unique features section of README
9 years ago
Dean Karn
ca7facef9c
Update README.md
...
update v6 accidentally left in README example to v7
9 years ago
Dean Karn
9a7e605915
Update README.md
...
update coverage badge
9 years ago
joeybloggs
4ab8352362
update benchmarks after nefield + necsfield changes
9 years ago
Dean Karn
72a602000a
Update README.md
...
update CI badge to v7
9 years ago
Dean Karn
95213db264
Update README.md
...
Update CI badge to v7-development branch
9 years ago
joeybloggs
55f9e44ce5
Update benchmarks for new go 1.5!
9 years ago
joeybloggs
15fdf82c30
Update verbiage for unique features for v7 cross struct cross field validation tags.
9 years ago
joeybloggs
14b90946b3
Backport v7 updates
...
backporting v7 updates for the near released v7.
9 years ago
joeybloggs
387cfe5aa9
Complete adding StructPartial and StructExcept
...
for issue-#149
9 years ago
joeybloggs
3697be93be
update benchmarks, pretty much the same
9 years ago
Dean Karn
f8fd45620a
Update README.md
...
update semaphore badge to production after merge
9 years ago
joeybloggs
d2ea21ad15
Add RegisterCustomTypeFunc for easier adding of CustomTypeFunc
...
Thanks @johnniedoe for ths pull request!
9 years ago
joeybloggs
6a8ed5612a
Update simple.go file && README
9 years ago
joeybloggs
d363ed316c
Add handling of custom types
...
can add custom type handling, example: sql driver Valuer
can override any base data type like string or int ( I'd be carefull about that, but you can )
9 years ago
joeybloggs
ea0db1fa47
Add single Field validation example
9 years ago
joeybloggs
aef21d4d30
Update Benchmarks
...
Split out benchmarks into Success and Failure for more realistic numbers.
I was validating 2 structs within the benchmarks, both a Successful and
Failing struct which was artificially inflating the numbers.
9 years ago
Dean Karn
a87651c07b
Update README.md
...
fix badge
9 years ago
Dean Karn
b009996c4a
Update README.md
...
update badge to proper branch
9 years ago
Dean Karn
ae135ef613
Update README.md
...
Change CI to Semaphore
9 years ago
joeybloggs
41b4a43989
Updated documentation for new v6
9 years ago