Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80027 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58309 invoked from network); 31 Dec 2014 20:26:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Dec 2014 20:26:39 -0000 Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:32956] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2E/D7-32362-CFB54A45 for ; Wed, 31 Dec 2014 15:26:37 -0500 Received: by h1123647.serverkompetenz.net (Postfix, from userid 33) id D569B23D6002; Wed, 31 Dec 2014 21:26:32 +0100 (CET) Received: from 217.254.134.120 (SquirrelMail authenticated user anatol@belski.net) by webmail.klapt.com with HTTP; Wed, 31 Dec 2014 21:26:32 +0100 Message-ID: In-Reply-To: References: Date: Wed, 31 Dec 2014 21:26:32 +0100 To: "Dmitry Stogov" Cc: "Nikita Popov" , "Xinchen Hui" , "PHP Internals" User-Agent: SquirrelMail/1.5.2 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Merge HashTable and zend_array into a single data structure. From: anatol.php@belski.net ("Anatol Belski") 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