in reply to Re: Does eval cause that much of a performance hit?
in thread Does eval cause that much of a performance hit?

It appears your reasons are aesthetic, can you elaborate on your reasons?

If preferring not having to read 45 lines of if{} in favor of much fewer then yes it is aesthetic. It just seems that 45 lines of if {} is just unnecessary and redundant. If there are 15 tests and I can see all 15 without having to page down then all the better.

Maybe. The rule of thumb is if it seems slow, or you need to run it often, try to make it faster.
It would take official benchmarking to determine that. It's negligable in real terms IMHO.

:) Can you quantify REALLY and that much ? eval EXPR is parsed and executed as if it were a little Perl program. So instead of parsing/executing one Perl program, you have one plus X many little ones. 1+X is slower than 1 :)
Ah now we're getting to a golden nugget. Seeing that eval EXPR is parsed and executed as if it were a little program and then having that eval to happen 15 times does answer my question to a degree although I believe the answer is going to involve a benchmark every time I want to make the point that using eval is negligable.

I appreciate your input on this.
Sherab
  • Comment on Re^2: Does eval cause that much of a performance hit?

Replies are listed 'Best First'.
Re^3: Does eval cause that much of a performance hit?
by Anonymous Monk on May 06, 2009 at 04:22 UTC
    It just seems that 45 lines of if {} is just unnecessary and redundant

    How? Instead of typing if(code){code} you type q{code},q{code} (or 'code' => 'code') just so it would fit on one page? That is very superficial, and I dare say, juvenile. Much much better idea would be to limit file size to what fits on one screen, say 30 lines ...