develooper Front page | perl.perl5.porters | Postings from April 2007

Re: Performance problems with Hash::Util::FieldHash

Thread Previous | Thread Next
Jerry D. Hedden
April 18, 2007 10:13
Re: Performance problems with Hash::Util::FieldHash
Message ID:
Jerry D. Hedden wrote:
> While I fully appreciate the significance of the work done
> by Anno, unless something drastic can be done to improve
> their performance, there doesn't seem to be any reason to
> bother trying to use field hashes.

Abigail wrote:
> Well, that sounds like a very harsh conclusion. Unless
> one's attitude is that speed if everything - in which case
> you haven't any reason to bother using Perl in the first
> place.
> *I* certainly will be using fieldhashes. Even if it's
> slower.

Excuse me for being insufficiently qualifying in my remarks.
I meant that because field hash performance is 5-10x slower
than the current OIO implementation, and offers no
additional features that are not already implemented in OIO,
it does not appear worthwhile for me to put in the effort to
integrate them as an option into the OIO module.

Speed isn't everything, true, but we shouldn't be satisfied
with sub-optimal performance if it can be improved upon.
Surely there is something amiss that set ops are 3.5x
slower (as shown by my results below).

> Having said that, I did some testing as well. I don't get
> much difference between 'refaddr' and stringification.
> Fieldhashes are slower when setting/getting, although the
> difference is much less on getting.
> Create/DESTROY
>         refaddr:   14.45 usec
>         stringify: 13.03 usec
>         fieldhash:  5.62 usec
> Set
>         refaddr:    5.86 usec
>         stringify:  5.01 usec
>         fieldhash:  7.70 usec
> Get
>         refaddr:    3.18 usec
>         stringify:  2.78 usec
>         fieldhash:  3.60 usec
> Cycle
>         refaddr:   24.27 usec
>         stringify: 21.47 usec
>         fieldhash: 35.63 usec

Of course, my mileage varies from yours (blead under

        refaddr:   33.25 usec
        stringify: 29.54 usec
        fieldhash:  1.93 usec
        refaddr:    6.88 usec
        stringify:  3.47 usec
        fieldhash: 12.05 usec
        refaddr:    6.71 usec
        stringify:  3.31 usec
        fieldhash:  5.10 usec
        refaddr:   51.07 usec
        stringify: 39.56 usec
        fieldhash: 54.28 usec

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About