in reply to Re^2: MLDBM performance problem
in thread MLDBM performance problem
... but I couldn't imagine the number would be doubled or tripled at any stage
It's fairly easily demonstrated. The string returned from scalar %hash is the no-of-buckets-used/no-of-buckets-allocated.
$buckets = %h; for ('aaaa'..'zzzz'){ $h{$_}=undef; ## Remove the conditional on the next line to see hat no bucket gr +owth ## occurs when an addition hashes to an existing value. print $buckets = %h if %h ne $buckets; };; 1/8 2/8 3/8 4/8 5/8 ##62% 6/16 7/16 8/16 9/16 10/16 ## 62% 15/32 16/32 17/32 18/32 19/32 20/32 21/32 ## 65% 25/64 26/64 27/64 28/64 29/64 30/64 31/64 32/64 33/64 34/64 35/64 36/64 37/64 38/64 39/64 40/64 41/64 ## 64% 51/128 52/128 53/128 54/128 55/128 56/128 57/128 58/128 59/128 60/128 61/128 62/128 63/128 64/128 65/128 66/128 67/128 68/128 69/128 70/128 71/128 72/128 73/128 74/128 75/128 76/128 77/128 78/128 79/128 80/128 81/128 82/128 83/128 84/128 85/128 ## 66% 106/256
Note that scalar %hash on a tied hash may do nothing or something completely different.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: MLDBM performance problem
by henrywalker23 (Novice) on Jun 11, 2007 at 05:58 UTC |