[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Memory requirements for data structures



On Mon, 2 Oct 2000 19:58:20 +0930, Henry Penninkilampi wrote:

>If you use a hash to set the value of 1024 8-byte keys to 1, then the 
>'visible payload' is 9 bytes per entry (or 9 KB for the whole thing).  
>Real world tests would suggest that it is one (or _two_) orders of 
>magnitude higher than that!
>
>While I appreciate that there is likely to be a 32-bit pointer (for each 
>entry) in there somewhere, that would only account for 44% of a 
>1,000..10,000% overhead.  What's taking up the rest?

I think that each scalar roughly takes about 30 bytes, plus the data if
it's too large to fit in there. Both keys and values are sclaraas, so
that's already 1024*2*30 = 60k; plus maybe 8k for the key data
themselves.

In addition, a hash is a special structure that is set up for fast
access. It's some sort of tree, with linked lists. That, too, takes
space. So, yes, 90k for this particular hash isn't abnormal.

I don't know any more details, sorry.

-- 
	Bart.

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org