Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71133 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68059 invoked from network); 15 Jan 2014 07:06:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2014 07:06:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 209.85.212.177 cause and error) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.212.177 mail-wi0-f177.google.com Received: from [209.85.212.177] ([209.85.212.177:39225] helo=mail-wi0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/C1-52301-C8336D25 for ; Wed, 15 Jan 2014 02:06:53 -0500 Received: by mail-wi0-f177.google.com with SMTP id hm2so1762793wib.4 for ; Tue, 14 Jan 2014 23:06:49 -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=Kjh9mZh/oo5ikzABSaJ/1aQK+CWUDX0NkmWpj5JfeSE=; b=bi/TNuxcmvDzAOS7vYL7bcbylYmQafogq3v5hckctdInWosMi/zhMGsGTx4Qd8lSKK QQ4Tx8pnVSx1fhXlRQG6A+pYQI9RUBaDMIzJsaxnUqwqnf7ul9C3groWXIu2IAFEyyEk 5e9Y6SuT94diNoJZNW4+Hl4nxJppsTniS0yke5uDS0IVOTO+ocRwohNKFf6g2HvJyKsv m7OQOtgqfEaAyJgL6Ul4NAq+dHXrvBczt/bLu5yuea+FMYr5GxU/dUTJlyqtuLdhNGrS 0632hrq6+Glg6saXs6X+jL0BNRsQbP0ylQgsVCP+czm8mW/x4NmdgpXY4wZcl+x0bGUi BZUQ== X-Gm-Message-State: ALoCoQnbGIbr9qNKK8H5ZbcIPvT32MmYK+IAz3AG/W860oy+gbzFOcVf8EeHzmnfhZnR+nWGxlk5dmcqNuseKbliPCvOuJt4XqdzDkNXWyoTIK+bza4+BBhHtxjsE48yZ3/yHf8RKyKq MIME-Version: 1.0 X-Received: by 10.181.12.20 with SMTP id em20mr655816wid.0.1389769608539; Tue, 14 Jan 2014 23:06:48 -0800 (PST) Received: by 10.227.91.198 with HTTP; Tue, 14 Jan 2014 23:06:48 -0800 (PST) In-Reply-To: <52D5CCAD.9040508@gmail.com> References: <52D5CCAD.9040508@gmail.com> Date: Wed, 15 Jan 2014 11:06:48 +0400 Message-ID: To: Terry Ellison Cc: Julien Pauli , PHP Internals Content-Type: multipart/alternative; boundary=f46d043bdfa2d6456404effcf3f6 Subject: Re: [PHP-DEV] New Memory Manager From: dmitry@zend.com (Dmitry Stogov) --f46d043bdfa2d6456404effcf3f6 Content-Type: text/plain; charset=UTF-8 Hi Terry, May be I misunderstood you. Macros must be inlined at compile-time anyway. Inlining of "slow-paths" of zval_copy_ctor/zval_dtor would cause "code explosion" and increase cache misses. However on Linux it must possible to put "hot" functions in one code section and reduce cache misses. Anyway, it's unrelated to Memory Manager. Thanks. Dmitry. On Wed, Jan 15, 2014 at 3:47 AM, Terry Ellison wrote: > 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 > --f46d043bdfa2d6456404effcf3f6--