in reply to Hash optimization in Perl?
There are really only two optimizations you can do with perl hashing - speed or size.
If you know the approximate size of your hash and want to speed up access, you can presize your hash
Given the set of keys you have, that may or may not really speed things up. The theory is that by allocating space up front, you prevent slow downs when the hash needs to be re-allocated.keys(%hash) = 1024;
For memory size, if you think your hash is going to consume more memory than you have, you should look into the various Tie::Hash modules that have a db backend.
Either way, both are probably the last places I would look for optimizations.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash optimization in Perl?
by ferreira (Chaplain) on May 02, 2007 at 11:23 UTC | |
|
Re^2: Hash optimization in Perl?
by Zaxo (Archbishop) on May 02, 2007 at 06:28 UTC | |
by Anonymous Monk on May 02, 2007 at 07:33 UTC |