[JaxPM] computing values vs. storing as hash

Greg Sabino Mullane greg at turnstep.com
Thu Jan 3 06:42:11 CST 2002


On the jacksonville-pm-list; Jax.PM'er "Greg Sabino Mullane" <greg at turnstep.com> wrote -


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I was wondering (more academically than anything else), 
> whether I should store the mapping of priority values to 
> facility/severity strings as hash or compute them on the fly.

In general, it is always better to use a hash. Hash lookups 
tend to be extremely fast compared to almost any other 
operation you perform, unless the operation is extremely 
simple and the hash extremely long. In this particular case, 
I'd use a hash. Matter of fact, I've never run up against a 
case where a computation was preferred over a hash.

</2 cents>

Greg Sabino Mullane
greg at turnstep.com
PGP Key: 0x14964AC8 200201030741

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iQA/AwUBPDRRhrybkGcUlkrIEQLfjQCdFqlQs3JAP7+wuqqwdabFSYG0fBUAoNpA
J8e6+ReNTC330ootrxdkVrju
=QE8Y
-----END PGP SIGNATURE-----




Jax.PM Moderator's Note:
This message was posted to the Jacksonville Perl Monger's Group listserv.
The group manager can be reached at -- owner-jacksonville-pm-list at pm.org
to whom send all praises, complaints, or comments...




More information about the Jacksonville-pm mailing list