On Dec 12, [EMAIL PROTECTED] said: >Any tool available for benchmarking scripts? (In idiotville I could >think of using the time in some fashion...but again welcome to >idiotville.)
You're gonna hate me for this... It's called Benchmark.pm, and it's a standard module (so you've already got it). You can run chunks of code and time them (either by a number of iterations, or a length of time to run): use Benchmark 'timethese'; # time 10,000 iterations timethese(10_000, { PUSH => sub { my @a = (1) x 1000; push @a, 1; }, NEW => sub { my @a = (1) x 1000; @a = (@a, 1); }, NONE => sub { my @a = (1) x 1000; }, }); # execute each for 5 seconds timethese(-5, { PUSH => sub { my @a = (1) x 1000; push @a, 1; }, NEW => sub { my @a = (1) x 1000; @a = (@a, 1); }, NONE => sub { my @a = (1) x 1000; }, }); The output is useful. If you meant PROFILING your program, there's a module, Devel::DProf (which is now standard in Perl 5.6), that gives a report of how much time your program spent doing what: perl -d:DProf yourprogram That produces a file called tmon.out, which you then use the program dprofpp to analyze (that comes with the module). For more, read the module's documentation. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]