Re: Smart strings & memory allocation
| From: | Stanislav Malyshev | Date: | Wed, 18 Jun 2003 13:53:55 +0000 |
| Subject: | Re: Smart strings & memory allocation | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-2368@lists.php.net to get a copy of this message | ||
DR>> Just curious, but why a fixed size block allocator?
Because the tests show that significant part of allocations fall in the
following categories (not in this particular order by frequency):
1. Small memory allocations (below 16 bytes)
2. zval allocations
3. Hashtable allocations
4. Hash bucket allocations
Those four categories in my tests happen to account for up to 40% of
emalloc calls which end up with malloc call (I didn't trace "raw"
mallocs, since most of them are either on init stage or are from some 3rd
party source and aren't common enough). Also, those are (at least
positions 2-4) the allocs which engine will definitely use, and use them a
lot. Those blocks sizes are fixed (we are not going to change zval a lot),
so the allocator which is good on fixed blocks (obviously, iff it's better
that general-purpose one) might help improving the performance of these
parts a lot. Again, this is not a proposal, that's merely an idea.
--
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.109