It is because Benchmark evals the code either way. It runs the code in the calling package, so if you give it a string to eval, then it just concatenates the package switching wrapper around the code, and evals it. If you give it a code ref, it just wraps the string "&$ref()" in a similar fashion.
Either way, you suffer the same eval STR overhead. In the subref case, you also suffer the cost of a function call.
In reply to Re^3: cannot get Benchmark to work
by fishbot_v2
in thread cannot get Benchmark to work
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |