> >> >http://www.wetware.com/drieux/CS/lang/Perl/Beginners/BenchMarks/complexArrayHash_v_loop. > >> txt > >> > >> for the details on the comparison.... > >> > >> looks like the double loop is faster.... but it may not be > >> in some other configuration of data... > > > > The dereference is probably wasting cycles, why not bring that outside > > the loop and save some time. I suspect that puts the double loop even > > further ahead. > > Benchmark: timing 1000000 iterations of doubleLoop, dullWay, pushList... > doubleLoop: 242130.75/s (n=1000000) # $hash->{key} > dullWay: 238663.48/s (n=1000000) # $hash{$key} > > which is not what I had expected
You sure about that? Seems very counter-intutive, you did remember that deferencing should save clock cycles when in a loop. E.g. my %hash = %{ $hash }; print $hash{$_} for 0..1000; Unless, of course, that the -> case is optimised in some devious way or dereferencing is deliberately crippled for our enjoyment. use Benchmark Jonathan Paton __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]