Re: Merge HashTable and zend_array into a single data structure.

From: Date: Wed, 31 Dec 2014 20:26:32 +0000
Subject: Re: Merge HashTable and zend_array into a single data structure.
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-80027@lists.php.net to get a copy of this message
Hi Dmitry, On Wed, December 31, 2014 11:19, Dmitry Stogov wrote: > 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. > > I've tested the patch on Windows x64 TS build. On my laptop the profiler tells 8.5m more instructions retired. I guess that's because of less dereferencing happening (it operates faster and pipelines have more idle time). Also there's less branch misprediction and a negligible memory usage increase. All in all - the patch is probably more like an intermediate step to the further optimization you mention. But even in the current patch state - there's no impact. Regards Anatol

« previous php.internals (#80027) next »