Hi!

> 262144 bytes used
> 
> That is definitely a significant improvement.
> 
> Objects are still a lot bigger than their contents. I don't expect
> they would ever shrink to the size of their contents exactly or even
> all that close of course.

Hashtables and zvals have overhead. So if you store 4-byte value, you have:
zval wrapper - 16 bytes
allocation unit - 8 bytes IIRC
hashtable bucket - 36 bytes

So you are already at 60 bytes per value. That's on 32-bit, on 64-bit
due to pointers and longs being wider, probably almost double that. Then
also add the storage for the key itself.

If you need more memory-efficient data storage, something like
SplFixedArray may help.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to