Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80022 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20310 invoked from network); 31 Dec 2014 10:19:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Dec 2014 10:19:12 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.180 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.180 mail-vc0-f180.google.com Received: from [209.85.220.180] ([209.85.220.180:60635] helo=mail-vc0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/32-32362-F9DC3A45 for ; Wed, 31 Dec 2014 05:19:12 -0500 Received: by mail-vc0-f180.google.com with SMTP id im6so6240855vcb.11 for ; Wed, 31 Dec 2014 02:19:09 -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:date:message-id:subject:from:to :content-type; bh=Nq6U1ZDGIAJZFJ4Qoz4c02NugfzNFDU0t3uUEKxco1Y=; b=lI698ZA5MjN8AWp4R8Avzw3w34gaz7ph+IosiMXCYtOYJNyCcCOOmU1QQj5V+caDNq nBKWFg94lAhec4HBbn7GIujVoBwgyxvTcRJN4+X6T8n1OgG9er7RbY9eQa2lbapngf6q YydUpbXBq6fUzbj5f1xcpBtcB7Ja1KyQo1gLmsciDYyU075AOfBSzV54DIEMWTwst7+x GL90Z4tj+05A8kaCKzEV12hY4cveaoLE9GGFjRUXbg1LLcvhJQ4bY+SRbqg/mIK01Snz k9LUQekJv1wvp5U1Rm9kuJvsBeYHaiMzVs7BVFKKe7o7awU7HC7RrTNvqsZFRQcJ5MNc tO3Q== X-Gm-Message-State: ALoCoQmH2cl9D3Vj/QoOsGVnzyppzAQywPfxY2FoCWOsBJovTTYMaOy+bk4Z9g584JUf7MSMmWEWrF/3gS7PjUWqWa0DLgZFhzHzwA/K9t/q1OLcsBf+lWotJwdRdfrRAdwHpyEe7DDZAn5EKhwpSG7BI/JxH9Ildg== MIME-Version: 1.0 X-Received: by 10.52.10.198 with SMTP id k6mr31077359vdb.38.1420021149145; Wed, 31 Dec 2014 02:19:09 -0800 (PST) Received: by 10.52.26.40 with HTTP; Wed, 31 Dec 2014 02:19:09 -0800 (PST) Date: Wed, 31 Dec 2014 14:19:09 +0400 Message-ID: To: Nikita Popov , Xinchen Hui , PHP Internals Content-Type: multipart/alternative; boundary=20cf30334e252b36c0050b807033 Subject: Merge HashTable and zend_array into a single data structure. From: dmitry@zend.com (Dmitry Stogov) --20cf30334e252b36c0050b807033 Content-Type: text/plain; charset=UTF-8 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. --20cf30334e252b36c0050b807033--