Merge HashTable and zend_array into a single data structure.
| From: | Dmitry Stogov | Date: | Wed, 31 Dec 2014 10:19:09 +0000 |
| Subject: | Merge HashTable and zend_array into a single data structure. | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-80022@lists.php.net to get a copy of this message | ||
Hi,
Please take a look into the patch
https://github.com/php/php-src/pull/970/files
This real changes are in zend_types.h, the rest is renaming that in most
cases makes code cleaner.
zend_array didn't change its binary representation, but now it's not
possible to get a pointer to embedded HashTable. The same zend_array shoukd
be used instead.
Each HashTable got an extra 64-bit zend_refcounted header. This leads to
some increase in memory consumption.
The performance is slightly increased (may be measured with callgrind).
The patch beaks one test (tests/lang/foreachLoopObjects.006.phpt), but
actually it just disclose a problem that we have anyway.
The patch should be a base for the future optimizations. e.g. removing
HashTable->arData and/or HashTable->arHash and allocating them together
with zend_array; introducing EG(empty_array) etc.
Opinions are welcome...
Thanks. Dmitry.