parrot-dev Digest, Vol 24, Issue 7
Paul C. Anagnostopoulos
paul at windfall.com
Fri Aug 6 20:23:11 UTC 2010
At 8/6/2010 08:00 AM, parrot-dev-request at lists.parrot.org wrote:
>From: chromatic <chromatic at wgz.org>
>
>The attached patch (for discussion, not application) attempts to resize hashes
>appropriately before thawing them. The current naive algorithm lets
>parrot_hash_put() double the size of the hash when it runs out of free
>buckets; for a hash which starts with 8 buckets and must contain 240 elements,
>parrot_hash_put() will perform five (to 16, 32, 64, 128, and finally 256
>buckets) reallocations.
As an aside, is this doubling in size each time considered a good thing? Seems okay up to about 64 or so, but then the table gets big fast. I'm sure everyone knows the trick of using a vector of sizes and representing the size in the hash as an index into the vector. The cool thing is that the vector can be customized.
~~ Paul
----------------------------------------------------------------
Windfall Paul C. Anagnostopoulos
----------------------------------------------------------
Software 978 371-2316
www.windfall.com
----------------------------------------------------------------
Metaphorical invocations ... often suffer from the
weakness of giving such satisfaction to the human
mind that they tend to be mistaken for incisive and
illuminating observations. ---Torkel Franzen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20100806/8b5d518c/attachment.html>
More information about the parrot-dev
mailing list