Perl array vs. hash handing over Benchmark

I want to compare the hash and array in Perl and both of them with a reference and a normal handing over.That is the code, I tried to hold it as simple and fast as possible:

Our result :

Looks good, the keys from the hashes are not sorted but I don’t want to waste performance with a sort.


Now this is the Benchmark result from 1..4 :

We could see the normal array is faster than the shift and prototype so for small data a reference is not faster than a normal use, but by the hash it is much faster than a normal handing over.and we could see array is faster than a hash, but the hash takes more information (key and values).


And this is the Benchmark result from 1..1000 :

Now the reference from the array and hash are both fastest, the hash is always slower than the array.Just take a look at scalars.

3 thoughts on “Perl array vs. hash handing over Benchmark”

  1. Hi there! Do you know if they make any plugins to help with SEO?
    I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good gains.
    If you know of any please share. Cheers!

  2. Thank you for sharing your info. I really appreciate your efforts and I am waiting for
    your next write ups thanks once again.

Leave a Reply

Your email address will not be published.

two × 1 =