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
The Gitter Badger
c4ae288afd
Added Gitter badge
9 years ago
Dean Karn
7422dd4828
update latest benchmarks
9 years ago
joeybloggs
46b655a956
add some benchmarks to readme
...
for #72
9 years ago
joeybloggs
c4203fff25
add file and README example
9 years ago
Dean Karn
82abe38795
Add test coverage badge
...
add test coverage badge for issue #92
9 years ago
Dean Karn
6ae296cb93
Update README.md
...
fix go get documentation, remove the -u option
10 years ago
Dean Karn
74d0e52ab3
Update README.md
...
update branch url for travis ci
10 years ago
Dean Karn
4e9461558c
Update README.md
10 years ago
Dean Karn
4c73ffba66
update verbiage after pull request
10 years ago
Anthony Olurin
700e5f4b46
Minor typos
...
- Changes made to documentation and ReadME.
10 years ago
Dean Karn
04b0ff368d
Update README.md
10 years ago
Dean Karn
7ac98be692
changes in preparation for package rename to validator
...
update code for more idiomatic code
10 years ago