in reply to Benchmarking shell script conversions
I'm hearing a bell in the back of my head, along with a quote about how premature optimization is the root of all evil.
Since you're converting these from shell scripts, I doubt you really need them to be efficent. Make them easy to understand and add efficency later if you really need it.
That said, if you want to test how long a certain block of code takes to execute, try this (untested):
my $start_time = times(); # Bunch of code here my $end_time = times(); my $run_time = $end_time - $start_time; print "Took $run_time sec\n";
Higher granuality clocks are also available (like Time::HiRes).
|
|---|