Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71128 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44815 invoked from network); 14 Jan 2014 23:48:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2014 23:48:04 -0000 Authentication-Results: pb1.pair.com header.from=ellison.terry@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ellison.terry@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.49 as permitted sender) X-PHP-List-Original-Sender: ellison.terry@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wg0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:37643] helo=mail-wg0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D4/00-44324-2BCC5D25 for ; Tue, 14 Jan 2014 18:48:03 -0500 Received: by mail-wg0-f49.google.com with SMTP id a1so1075408wgh.4 for ; Tue, 14 Jan 2014 15:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=yj86Md2kfFQDnc/qTmGzRFYlJ7FTlBACwu4GPv943+Y=; b=qrvJfea8VlvxiXgN9UF/38FBSQgPml/PcPfpB65r57YTimpDj7lR4aM471tjMijiEf /hdeEqp001hFhISzvbtpdRb4BQf0NfjUHvNtvrhCODcZaijj9xofVp4ZD46qQk2SC79F W+CE4oJ1/4GcrIufDn0LhRW2cTw0zFj7dMxEfq4qob1eAl870ZTjw9/TLwSVoD7kXXQM eihDVhMRc1vn58lUhCmxRAzsCi5Pz1fX0kkPKCymut3rlnR6Te+S2t8UXHfwEKwaANwV 4FUq7WMw7zg5KKj02ya7W08LD+SXJHrGAG04urnNWikA2ax0b7d4Lm0LIMHslM1zH5w2 urlg== X-Received: by 10.194.78.79 with SMTP id z15mr974799wjw.15.1389743279290; Tue, 14 Jan 2014 15:47:59 -0800 (PST) Received: from [192.168.1.91] (host86-155-210-65.range86-155.btcentralplus.com. [86.155.210.65]) by mx.google.com with ESMTPSA id po3sm1855283wjc.3.2014.01.14.15.47.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 15:47:58 -0800 (PST) Message-ID: <52D5CCAD.9040508@gmail.com> Date: Tue, 14 Jan 2014 23:47:57 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Julien Pauli , Dmitry Stogov CC: PHP Internals References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------070108050008090408020808" Subject: Re: [PHP-DEV] New Memory Manager From: ellison.terry@gmail.com (Terry Ellison) --------------070108050008090408020808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 14/01/14 18:21, Julien Pauli wrote: > On Tue, Jan 14, 2014 at 5:45 PM, Dmitry Stogov wrote: >> Of course I tried to plug jemalloc and tcmalloc but they make slowdown >> instead of speedup, mainly because zend_alloc was especially designed for >> PHP and also because they suffer from multi-threading support overhead. On >> the other hand profiling PHP with oprofile I saw a lot of cache misses in >> zend_alloc.c, especially because of linked list handling. So I tried to >> combine the best from all approaches and then spend a couple of week tuning >> it. >> >> Thanks. Dmitry. >> > Yes, I was reading the great job you've done so far ! > Looking forward in testing this myself and why not fix bugs or give > some more ideas :-) > > Anyway, the different pool sizes is nice. > We already got an idea like this in ZendMM with the "small free block" > VS "free block" linked lists, but the implementation you've done so > far is pretty nice evolution. > > I think we can improve stuff by studying more accurate caches for > frequently used C-objects such as zvals or zend_object's structures. One of the most common macro uses for both emalloc and efree primitives is in the CTOR and DTOR of zval structures. This is HOT code, yet the code involved is split across three main modules totalling less that 10K lines. As a comparison zend_vm_execute.h is over 40K lines to allow the CC optimizer to optimize across the entire source code. Wouldn't it make a lot more sense to combine zend_variables.c, zend_hash.c and zend_alloc.c into a single module (do it by #include directive as zend_execute.c incorporates zend_vm_execute.h) so that the CC optimizer can properly optimitise these CTORs and DTORs? The DTOR for a ZVAL which itself a simple ZVAL hierarchy such as a an array should be executed as a dense code sequence that can comfortably run out of the L1Instr cache, with minimal cache misses and BLT failure stalls. Regards Terry --------------070108050008090408020808--