in reply to Re: Question about benchmarking
in thread Question about benchmarking

There is an example of using the Benchmark module to compare different algorithms at this node on searching for an array index.

One difficult part of benchmarking is keeping track of what you have changed, and what effect these changes had. Here is one way to do it:

First, isolate the part of your code that needs improvement in a subroutine. Then, create new subroutines with different names to try different approaches. Preserve the different implementations of the subroutine in the program. This ensures that you don't accidentally change something else in your code that ruins your comparison data. The Benchmark node mentioned above shows an example of this approach.

If you keep your subroutine short, it is easy for other people, such as Perl Monks, to help speed up your code.

It should work perfectly the first time! - toma