in reply to Re: does a hash element as a loop parameter cause significant slowdown?
in thread does a hash element as a loop parameter cause significant slowdown?

> Use Benchmark to check for "significant slowdown"

Yes. I really like TheDamian's simple adage "Don't Optimize Code -- Benchmark It" - if you don't follow his advice, you'll probably end up with a fast slow program. :)

Without good design, good algorithms, and complete understanding of the program's operation, your carefully optimized code will amount to one of mankind's least fruitful creations -- a fast slow program.

-- Michael Abrash

Correctness, simplicity and clarity come first ... so you shouldn't really consider optimizing that little piece of code until you've benchmarked the entire program and identified it as a chronic bottleneck.

For an example of using Benchmark to compare different snippets of Perl code see: Re^3: looping efficiency (Benchmark Example)

Updated: added Michael Abrash quote to clarify what I meant by a fast slow program. Added Correctness, simplicity and clarity paragraph.

  • Comment on Re^2: does a hash element as a loop parameter cause significant slowdown?