in reply to Re: How expensive is eval { }?
in thread How expensive is eval { }?

Thanks,
that's a good idea.

I'm getting results from -3% to -6% in favor for sub on my machine. I might write a bigger benchmark and post the results here.

Replies are listed 'Best First'.
Re^3: How expensive is eval { }?
by moritz (Cardinal) on Apr 17, 2008 at 09:25 UTC
    I rerun the test several times and with different perl version (5.8.8 and 5.10.0), and got results from 0% to -4%.

    You can see that our both results have higher noise than the difference, so I wouldn't base a design decision on it. If exceptions are cleaner from a programming POV I'd go with exceptions.