Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80040 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13542 invoked from network); 1 Jan 2015 12:31:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jan 2015 12:31:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:41287] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/67-60454-30E35A45 for ; Thu, 01 Jan 2015 07:31:00 -0500 Received: by mail-vc0-f170.google.com with SMTP id hy4so6750140vcb.1 for ; Thu, 01 Jan 2015 04:30:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=W43KON2oqWzqFNz6LLwpATbupozxy1HeKrwp+ACL4+s=; b=S89zBHB+eD/zL5nJdnVT+IuqRB/pXyaPG2SA0NG9ljFu2WK8km7n8dVoTMA4GaE5iN mZm3HZyMZm5i33I4BWqotv/MmsuRjk9W8h9vIVR9wXRviH9Q9blfspRFMuDGYKr1rIM3 NTRv5zfYM6Cll0mGRuKnSWqL9FnbKOFi2terGHVj0djXKTzQ6BN5D+iNG9h5DPvjTAuO egp5K6TWokbz0pDWtCg1Qs738eUnHqsfwGD0YtFC5mNWfcwHmnFqpFOjGddUICZOq5sx uMnXfQGrSuhS45DlFDS2VJa/5OFYLCFP4x4E78YYR+i8AUSW9+uayAjfwPZrTmIO5JvL YiaA== X-Gm-Message-State: ALoCoQmzAergYsJIvBHvuGU/q+p2sAZ9TOSs1JR+IWFFPPS65U4U0J6AzKDTdTZvYSmKmA4blYh5b/eaCWgz0mUCKtGh957sCcXCnEkWEzynIXZzNbS8hJ9Ra4TzLIGegtXLiYpUnREPs74dpiAV1tIHMtrbkzSXsg== MIME-Version: 1.0 X-Received: by 10.52.246.11 with SMTP id xs11mr35043632vdc.49.1420115456871; Thu, 01 Jan 2015 04:30:56 -0800 (PST) Received: by 10.52.26.40 with HTTP; Thu, 1 Jan 2015 04:30:56 -0800 (PST) Received: by 10.52.26.40 with HTTP; Thu, 1 Jan 2015 04:30:56 -0800 (PST) In-Reply-To: References: Date: Thu, 1 Jan 2015 16:30:56 +0400 Message-ID: To: Anatol Belski Cc: PHP Internals , Xinchen Hui , Nikita Popov Content-Type: multipart/alternative; boundary=001a1133eb2a58e09f050b96652c Subject: Re: [PHP-DEV] Merge HashTable and zend_array into a single data structure. From: dmitry@zend.com (Dmitry Stogov) --001a1133eb2a58e09f050b96652c Content-Type: text/plain; charset=UTF-8 Thanks for analizing. did you say "8.5 more" instructions? in my test I saw "less". It's really an intermedie step, and we probably will check if other optimizations are reaaly benefitable before committing this. But yes, this patch doesn't make any degradation, except for slight increase of memory consumption. Thanks. Dmitry. On Jan 1, 2015 12:26 AM, "Anatol Belski" wrote: > 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 > --001a1133eb2a58e09f050b96652c--