Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Advocacy > RE: Hash Perfor...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 43 of 88
Post > Topic >>

RE: Hash Performance

by charles.e.derykus@[EMAIL PROTECTED] (Charles E DeRykus) Dec 15, 2005 at 02:58 PM

Unless the hashes are very big, I'd agree the problem is likely
elsewhere. The
Perl code profiler might shed some light on the bottlenecks:
  =20
   perldoc Devel:Dprof   (available with Perl..  5.6.1 or later..maybe
earlier)

If the code doesn't profile easily, you might just benchmark creation
time for
similarly sized hashes for a seat-of-the-pants feel.=20

On my busy server, for instance,  a 50K hash consistently takes under a
second to=20
generate:

     my %hash =3D map { ($_, rand $_ ) } 1..50_000;

A 50K array takes under a third of the time:

     my @[EMAIL PROTECTED]
 $array[$_] =3D rand $_ for 1..50_000;

This is very simplistic but still you can get clues about when size
starts to
stretch completion times.



Hth,
--
Charles DeRykus  =20
    =20

-----Original Message-----
From: Haufler, Wayne A=20
Sent: Thursday, December 15, 2005 8:55 AM
To: advocacy@[EMAIL PROTECTED]
 Haufler, Wayne A
Subject: Hash Performance

One of my roles in a Tools Development group at Boeing is to help
maintain existing Perl programs and to champion the use of Perl in
future development.

One of the developers here has the impression /opinion that Perl Hashes
are slow.  That was because of the poor performance of the GUI menu of a
particular Perl tool, but I believe the poor performance is due to other
factors.  May be able to prove that later.

I have browsed through my extensive collection of O'Reilly Perl books,
and websites, but can't seem to find anything to support my contention
that hashes are very efficient, almost as much as arrays, and shouldn't
be avoided.

Am I right?  Can anyone point me to supporting material?
(I couldn't find any perl-performance related mailing list)

I hope to include that in a Perl class I will be teaching to my group
early next year.

Thank you,
Wayne Haufler

Senior Software Engineer (SE)
In Space Shuttle Program (SSP)
Backup Flight System (BFS) Tools Group
Boeing, NASA Systems, Houston
E-mail: wayne.a.haufler@[EMAIL PROTECTED]
    :  Perl,Unix,C,C++,SQL,QNX,X-Windows =20

(Disclaimer: The comments and opinions expressed are my own and do not
represent the view of  Boeing, United Space Alliance, JSC, or NASA.)




 1 Posts in Topic:
RE: Hash Performance
charles.e.derykus@[EMAIL   2005-12-15 14:58:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon May 12 21:45:42 CDT 2008.