Hi, i have 2 pieces of code that i created, both of which do exactly the same thing and i am trying to benchmark them to see which is generally more efficient. As such i used the code suggested by perldoc in the following format:
use Benchmark; $t0 = Benchmark->new; # ... your code here ... $t1 = Benchmark->new; $td = timediff($t1, $t0); print "the code took:",timestr($td),"\n";
However both of my code samples are really short and as such come up with a result of "0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)"
The fact that both codes run fast is great and all, but both codes use completely different methods, and for the sake of future programming projects, i would like to know which code is functioning more efficiently than the other.
So what i am asking is, how do i benchmark code to fractions of a second?
Thanks for any help.