Commit graph

528 commits

Author SHA1 Message Date
Dean Karn
852e5ff9f9 Merge pull request #252 from go-playground/v8
Update README.md
2016-08-06 22:00:05 -04:00
joeybloggs
2de56ed26a add parallel versions of all benchmarks 2016-08-06 21:47:16 -04:00
joeybloggs
3e196d49c6 saving some bytes uint8 vs int 2016-08-06 20:41:38 -04:00
joeybloggs
b2c8f66e7b why pass the Field names, they already belong to the namespaces... 2016-08-06 20:18:19 -04:00
joeybloggs
ea09db9292 aha! there's the extra allocation(s) Ive been chasing down! 2016-08-06 16:03:45 -04:00
joeybloggs
1714ba2b67 convert switch to if 2016-08-06 15:47:17 -04:00
joeybloggs
6765805f88 continuing perf optimizations 2016-08-06 15:23:45 -04:00
joeybloggs
27b607d6ad avoid a couple of dive allocations 2016-08-06 14:19:33 -04:00
joeybloggs
01925e342a regain 100% test coverage 2016-08-06 14:09:18 -04:00
joeybloggs
ecad6333b1 increase dive tag performance. 2016-08-06 13:55:36 -04:00
joeybloggs
dcdba454d7 some variable cleanup 2016-08-05 23:21:09 -04:00
joeybloggs
d9bfef9fe0 speed up structPartial and structExcept string parsing 2016-08-05 23:11:33 -04:00
joeybloggs
8d0fd80a80 removed creation of a couple stack variables and creation of errors 2016-08-05 23:02:12 -04:00
joeybloggs
a8f7aaba72 remove TODO: tried it, only helped with 1 allocation, not worth the overhead and potential contention 2016-08-05 22:34:40 -04:00
joeybloggs
f581a2d517 reuse field 2016-08-05 22:26:20 -04:00
joeybloggs
98dee40973 perf updates all around! 2016-08-05 22:15:08 -04:00
joeybloggs
560bff6526 testing 2016-08-05 16:10:01 -04:00
joeybloggs
8c60a612c5 code coverage back to 100% + some code cleanup 2016-08-05 12:34:43 -04:00
joeybloggs
2fe87f7a8d better error message. 2016-08-05 07:54:57 -04:00
joeybloggs
5fedd8c08a buffer errTag + errs array. 2016-08-05 07:15:25 -04:00
joeybloggs
5d28ac67f7 remove validatable logic as it does't really work, both with clarity and pointer vs non-pointer receivers 2016-08-04 21:20:58 -04:00
joeybloggs
1ff58be284 finish conversion of test + some fixes. 2016-08-04 11:00:01 -04:00
joeybloggs
3bf69e2bbd converting tests 2016-08-03 22:02:47 -04:00
joeybloggs
7e731afde9 field name updates 2016-08-03 19:20:42 -04:00
joeybloggs
e0e1af6a61 working instance 2016-08-03 14:46:35 -04:00
Dean Karn
598aac293f Update README.md 2016-08-02 09:45:00 -04:00
joeybloggs
5f57d2222a increment version in README 2016-07-18 09:41:25 -04:00
joeybloggs
77f59a0ea0 corrected some spelling mistakes in documentation 2016-07-18 09:40:22 -04:00
joeybloggs
1d3a3d281b Merge branch 'minor-perf-1' into v8 2016-07-18 09:13:00 -04:00
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%

```
2016-07-18 09:06:08 -04:00
joeybloggs
80301d1184 fix go report card badge. 2016-07-14 17:11:36 -04:00
joeybloggs
49d9b2c35e Merge branch 'minor-perf-merge' into minor-perf-1 2016-07-14 17:06:10 -04:00
joeybloggs
99a0f5e141 Merge branch 'merge' into minor-perf-merge
# Conflicts:
#	util.go
#	validator.go
#	validator_test.go
2016-07-14 17:06:03 -04:00
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
2016-07-14 16:46:21 -04:00
Dean Karn
393130c3f4 Merge pull request #248 from go-playground/v8
Merge v8 changes
2016-07-11 16:20:11 -04:00
joeybloggs
3ef55a89aa fix some needed Type() calls. 2016-07-11 14:41:27 -04:00
joeybloggs
43f7b7d61a save some bytes 2016-07-11 14:32:42 -04:00
joeybloggs
05d6aece82 remove a few TODO's attempted but perf didn't increase. 2016-07-11 14:10:46 -04:00
joeybloggs
4ce4d1cd71 gain another 5% on average by changing tag type from bool's to enum
```

benchmark                                               old ns/op     new ns/op     delta
BenchmarkFieldSuccess-4                                 117           116           -0.85%
BenchmarkFieldFailure-4                                 675           651           -3.56%
BenchmarkFieldDiveSuccess-4                             2518          2418          -3.97%
BenchmarkFieldDiveFailure-4                             3096          3011          -2.75%
BenchmarkFieldCustomTypeSuccess-4                       319           297           -6.90%
BenchmarkFieldCustomTypeFailure-4                       688           680           -1.16%
BenchmarkFieldOrTagSuccess-4                            1251          1176          -6.00%
BenchmarkFieldOrTagFailure-4                            1090          1073          -1.56%
BenchmarkStructLevelValidationSuccess-4                 558           567           +1.61%
BenchmarkStructLevelValidationFailure-4                 608           562           -7.57%
BenchmarkStructSimpleCustomTypeSuccess-4                702           636           -9.40%
BenchmarkStructSimpleCustomTypeFailure-4                1380          1295          -6.16%
BenchmarkStructPartialSuccess-4                         1139          1058          -7.11%
BenchmarkStructPartialFailure-4                         1760          1648          -6.36%
BenchmarkStructExceptSuccess-4                          951           917           -3.58%
BenchmarkStructExceptFailure-4                          1147          1085          -5.41%
BenchmarkStructSimpleCrossFieldSuccess-4                873           783           -10.31%
BenchmarkStructSimpleCrossFieldFailure-4                1478          1384          -6.36%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4     1328          1273          -4.14%
BenchmarkStructSimpleCrossStructCrossFieldFailure-4     1949          1896          -2.72%
BenchmarkStructSimpleSuccess-4                          559           523           -6.44%
BenchmarkStructSimpleFailure-4                          1334          1311          -1.72%
BenchmarkStructSimpleSuccessParallel-4                  148           137           -7.43%
BenchmarkStructSimpleFailureParallel-4                  631           591           -6.34%
BenchmarkStructComplexSuccess-4                         3476          3500          +0.69%
BenchmarkStructComplexFailure-4                         8467          8406          -0.72%
BenchmarkStructComplexSuccessParallel-4                 1098          1012          -7.83%
BenchmarkStructComplexFailureParallel-4                 3113          3121          +0.26%

benchmark                                               old allocs     new allocs     delta
BenchmarkFieldSuccess-4                                 0              0              +0.00%
BenchmarkFieldFailure-4                                 4              4              +0.00%
BenchmarkFieldDiveSuccess-4                             28             28             +0.00%
BenchmarkFieldDiveFailure-4                             32             32             +0.00%
BenchmarkFieldCustomTypeSuccess-4                       2              2              +0.00%
BenchmarkFieldCustomTypeFailure-4                       4              4              +0.00%
BenchmarkFieldOrTagSuccess-4                            1              1              +0.00%
BenchmarkFieldOrTagFailure-4                            6              6              +0.00%
BenchmarkStructLevelValidationSuccess-4                 5              5              +0.00%
BenchmarkStructLevelValidationFailure-4                 5              5              +0.00%
BenchmarkStructSimpleCustomTypeSuccess-4                3              3              +0.00%
BenchmarkStructSimpleCustomTypeFailure-4                9              9              +0.00%
BenchmarkStructPartialSuccess-4                         9              9              +0.00%
BenchmarkStructPartialFailure-4                         14             14             +0.00%
BenchmarkStructExceptSuccess-4                          7              7              +0.00%
BenchmarkStructExceptFailure-4                          9              9              +0.00%
BenchmarkStructSimpleCrossFieldSuccess-4                4              4              +0.00%
BenchmarkStructSimpleCrossFieldFailure-4                9              9              +0.00%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4     7              7              +0.00%
BenchmarkStructSimpleCrossStructCrossFieldFailure-4     12             12             +0.00%
BenchmarkStructSimpleSuccess-4                          1              1              +0.00%
BenchmarkStructSimpleFailure-4                          9              9              +0.00%
BenchmarkStructSimpleSuccessParallel-4                  1              1              +0.00%
BenchmarkStructSimpleFailureParallel-4                  9              9              +0.00%
BenchmarkStructComplexSuccess-4                         15             15             +0.00%
BenchmarkStructComplexFailure-4                         60             60             +0.00%
BenchmarkStructComplexSuccessParallel-4                 15             15             +0.00%
BenchmarkStructComplexFailureParallel-4                 60             60             +0.00%

benchmark                                               old bytes     new bytes     delta
BenchmarkFieldSuccess-4                                 0             0             +0.00%
BenchmarkFieldFailure-4                                 432           432           +0.00%
BenchmarkFieldDiveSuccess-4                             464           464           +0.00%
BenchmarkFieldDiveFailure-4                             896           896           +0.00%
BenchmarkFieldCustomTypeSuccess-4                       32            32            +0.00%
BenchmarkFieldCustomTypeFailure-4                       432           432           +0.00%
BenchmarkFieldOrTagSuccess-4                            4             4             +0.00%
BenchmarkFieldOrTagFailure-4                            448           448           +0.00%
BenchmarkStructLevelValidationSuccess-4                 160           160           +0.00%
BenchmarkStructLevelValidationFailure-4                 160           160           +0.00%
BenchmarkStructSimpleCustomTypeSuccess-4                36            36            +0.00%
BenchmarkStructSimpleCustomTypeFailure-4                640           640           +0.00%
BenchmarkStructPartialSuccess-4                         336           336           +0.00%
BenchmarkStructPartialFailure-4                         794           794           +0.00%
BenchmarkStructExceptSuccess-4                          314           314           +0.00%
BenchmarkStructExceptFailure-4                          336           336           +0.00%
BenchmarkStructSimpleCrossFieldSuccess-4                80            80            +0.00%
BenchmarkStructSimpleCrossFieldFailure-4                536           536           +0.00%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4     112           112           +0.00%
BenchmarkStructSimpleCrossStructCrossFieldFailure-4     576           576           +0.00%
BenchmarkStructSimpleSuccess-4                          4             4             +0.00%
BenchmarkStructSimpleFailure-4                          640           640           +0.00%
BenchmarkStructSimpleSuccessParallel-4                  4             4             +0.00%
BenchmarkStructSimpleFailureParallel-4                  640           640           +0.00%
BenchmarkStructComplexSuccess-4                         244           244           +0.00%
BenchmarkStructComplexFailure-4                         3608          3608          +0.00%
BenchmarkStructComplexSuccessParallel-4                 244           244           +0.00%
BenchmarkStructComplexFailureParallel-4                 3608          3608          +0.00%

```
2016-07-11 13:54:33 -04:00
joeybloggs
330b12dacd Phase 1 optimization complete, Phase 2 ( Warm liquid goo phase ) commencing
Still looking good

```

benchmark                                               old ns/op     new ns/op     delta
BenchmarkFieldSuccess-4                                 167           119           -28.74%
BenchmarkFieldFailure-4                                 701           653           -6.85%
BenchmarkFieldDiveSuccess-4                             2937          2488          -15.29%
BenchmarkFieldDiveFailure-4                             3536          3059          -13.49%
BenchmarkFieldCustomTypeSuccess-4                       341           292           -14.37%
BenchmarkFieldCustomTypeFailure-4                       679           679           +0.00%
BenchmarkFieldOrTagSuccess-4                            1157          1146          -0.95%
BenchmarkFieldOrTagFailure-4                            1109          1063          -4.15%
BenchmarkStructLevelValidationSuccess-4                 694           559           -19.45%
BenchmarkStructLevelValidationFailure-4                 1311          551           -57.97%
BenchmarkStructSimpleCustomTypeSuccess-4                894           641           -28.30%
BenchmarkStructSimpleCustomTypeFailure-4                1496          1302          -12.97%
BenchmarkStructPartialSuccess-4                         1229          1071          -12.86%
BenchmarkStructPartialFailure-4                         1838          1685          -8.32%
BenchmarkStructExceptSuccess-4                          961           927           -3.54%
BenchmarkStructExceptFailure-4                          1218          1068          -12.32%
BenchmarkStructSimpleCrossFieldSuccess-4                954           779           -18.34%
BenchmarkStructSimpleCrossFieldFailure-4                1569          1405          -10.45%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4     1588          1299          -18.20%
BenchmarkStructSimpleCrossStructCrossFieldFailure-4     2217          1917          -13.53%
BenchmarkStructSimpleSuccess-4                          925           519           -43.89%
BenchmarkStructSimpleFailure-4                          1650          1323          -19.82%
BenchmarkStructSimpleSuccessParallel-4                  261           149           -42.91%
BenchmarkStructSimpleFailureParallel-4                  758           543           -28.36%
BenchmarkStructComplexSuccess-4                         5868          3387          -42.28%
BenchmarkStructComplexFailure-4                         10767         8498          -21.07%
BenchmarkStructComplexSuccessParallel-4                 1559          1114          -28.54%
BenchmarkStructComplexFailureParallel-4                 3747          3163          -15.59%

```
2016-07-11 11:39:04 -04:00
joeybloggs
210684a828 code cleanup + add missing tag cache with FieldWith func
Still looking good:

```

benchmark                                               old ns/op     new ns/op     delta
BenchmarkFieldSuccess-4                                 167           119           -28.74%
BenchmarkFieldFailure-4                                 701           650           -7.28%
BenchmarkFieldDiveSuccess-4                             2937          2482          -15.49%
BenchmarkFieldDiveFailure-4                             3536          3046          -13.86%
BenchmarkFieldCustomTypeSuccess-4                       341           296           -13.20%
BenchmarkFieldCustomTypeFailure-4                       679           666           -1.91%
BenchmarkFieldOrTagSuccess-4                            1157          1124          -2.85%
BenchmarkFieldOrTagFailure-4                            1109          1036          -6.58%
BenchmarkStructLevelValidationSuccess-4                 694           554           -20.17%
BenchmarkStructLevelValidationFailure-4                 1311          558           -57.44%
BenchmarkStructSimpleCustomTypeSuccess-4                894           654           -26.85%
BenchmarkStructSimpleCustomTypeFailure-4                1496          1286          -14.04%
BenchmarkStructPartialSuccess-4                         1229          1062          -13.59%
BenchmarkStructPartialFailure-4                         1838          1639          -10.83%
BenchmarkStructExceptSuccess-4                          961           919           -4.37%
BenchmarkStructExceptFailure-4                          1218          1072          -11.99%
BenchmarkStructSimpleCrossFieldSuccess-4                954           800           -16.14%
BenchmarkStructSimpleCrossFieldFailure-4                1569          1372          -12.56%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4     1588          1274          -19.77%
BenchmarkStructSimpleCrossStructCrossFieldFailure-4     2217          1901          -14.25%
BenchmarkStructSimpleSuccess-4                          925           512           -44.65%
BenchmarkStructSimpleFailure-4                          1650          1318          -20.12%
BenchmarkStructSimpleSuccessParallel-4                  261           144           -44.83%
BenchmarkStructSimpleFailureParallel-4                  758           581           -23.35%
BenchmarkStructComplexSuccess-4                         5868          3451          -41.19%
BenchmarkStructComplexFailure-4                         10767         8351          -22.44%
BenchmarkStructComplexSuccessParallel-4                 1559          1065          -31.69%
BenchmarkStructComplexFailureParallel-4                 3747          2916          -22.18%

```
2016-07-11 09:09:25 -04:00
joeybloggs
c0a414dc9e initial un-refined new caching system 2016-07-11 08:53:33 -04:00
joeybloggs
5c8ad6a1a9 only check struct validity once 2016-07-09 16:02:29 -04:00
joeybloggs
cdfcf16a86 fix some minor listing. 2016-07-09 11:28:37 -04:00
Dean Karn
25f1823069 Merge pull request #243 from kenkouot/patch-1
Fix typo: ne is validation key for not equal
2016-06-21 21:15:37 -04:00
Kenneth Kouot
719d0b12ee Fix another typo: eq to ne 2016-06-21 17:11:27 -07:00
Kenneth Kouot
3499e730cb Fix typo: ne is validation key for not equal 2016-06-21 16:50:52 -07:00
joeybloggs
014792cf3e Update README version 2016-02-23 15:26:51 -05:00
joeybloggs
e7749ea250 Update validations for "url" and "uri" because of Go 1.6 changes
added checks for blank and fragment/suffix because of Go 1.6 change 617c93ce74 (diff-6c2d018290e298803c0c9419d8739885L195)
fix was to emulate browser and strip the '#' suffix prior to validation. see #237
2016-02-23 15:26:02 -05:00
joeybloggs
93bb347253 Update validations for "url" and "uri" because of Go 1.6 changes
added checks for blank and fragment/suffix because of Go 1.6 change 617c93ce74 (diff-6c2d018290e298803c0c9419d8739885L195)
fix was to emulate browser and strip the '#' suffix prior to validation. see #237
2016-02-23 15:25:49 -05:00