Subject: | Comparison to Params::ValidationCompiler isn't really accurate |
I actually wrote some benchmarks comparing MXPV, TP, and PVC (the latter with Specio, Moose, and TT). While for _positional_ params TP and PVC are quite close, for named params PVC is way faster. This is because PVC handles this "natively" while with TP you have to use a Dict type.
Note that I just pushed a fix to one of the benchmark scripts so if you want to check this out you should look at the git repo (https://github.com/houseabsolute/Params-ValidationCompiler)
Here's the full benchmark output using the latest version of each module:
$ perl ./eg/bench-named.pl
# Seeded srand with seed '20170504' from local date.
Rate mxpv_lives tp_lives pcc_tt_lives pcc_specio_lives pcc_moose_lives
mxpv_lives 19493/s -- -71% -86% -86% -87%
tp_lives 66667/s 242% -- -52% -52% -54%
pcc_tt_lives 138889/s 612% 108% -- -0% -4%
pcc_specio_lives 138889/s 612% 108% 0% -- -4%
pcc_moose_lives 144928/s 643% 117% 4% 4% --
Rate mxpv_dies pcc_specio_dies pcc_moose_dies tp_dies pcc_tt_dies
mxpv_dies 6793/s -- -21% -22% -58% -76%
pcc_specio_dies 8591/s 26% -- -1% -46% -69%
pcc_moose_dies 8666/s 28% 1% -- -46% -69%
tp_dies 16026/s 136% 87% 85% -- -42%
pcc_tt_dies 27778/s 309% 223% 221% 73% --
$ perl ./eg/bench-pos.pl
Rate mxpv_lives pcc_specio_lives pcc_moose_lives tp_lives pcc_tt_lives
mxpv_lives 23585/s -- -91% -92% -93% -93%
pcc_specio_lives 271739/s 1052% -- -8% -21% -24%
pcc_moose_lives 295858/s 1154% 9% -- -14% -18%
tp_lives 342466/s 1352% 26% 16% -- -5%
pcc_tt_lives 359712/s 1425% 32% 22% 5% --
Rate mxpv_dies pcc_specio_dies pcc_moose_dies pcc_tt_dies tp_dies
mxpv_dies 6711/s -- -20% -20% -76% -77%
pcc_specio_dies 8418/s 25% -- -0% -69% -71%
pcc_moose_dies 8432/s 26% 0% -- -69% -71%
pcc_tt_dies 27473/s 309% 226% 226% -- -6%
tp_dies 29240/s 336% 247% 247% 6% --
You can also see that the speed of passing vs failing a validation test is quite different for different tools. This mostly depends on whether an exception object is thrown versus just a string.