Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71123 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3989 invoked from network); 14 Jan 2014 16:45:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2014 16:45:07 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 74.125.82.182 cause and error) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 74.125.82.182 mail-we0-f182.google.com Received: from [74.125.82.182] ([74.125.82.182:37497] helo=mail-we0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/90-33466-19965D25 for ; Tue, 14 Jan 2014 11:45:06 -0500 Received: by mail-we0-f182.google.com with SMTP id w62so651818wes.13 for ; Tue, 14 Jan 2014 08:45:03 -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=e9UzDzfqwrZFAZiiew+P/n3lA+kNmJYqpw4CEhywh10=; b=kO6mZ7IWKoE3ReCjjcDbp6CdpmeOb7c5Dt4YoZf+cMmPwItFVH0NlbqpM/amejnpSp cvVCnH5XD3Yk3BBPaSsbIbt8mCbcS+PlmSwI7ICVL9plORIxnM+OzW7bmLYkagmmsuu4 BML36LA5+NblXwMeAVt8B1f03K5XZC57o0Hm70t7vKweSlEwms+wU+FBiwch43awkRAZ GiBAnpMEHJhf7MzO/TOgGidUpFpi1eJT8R9CbH+LdzHdbeCWQjUmBKgFoTlwiF6tOYm4 tizprwXfYzstri+grav/BxsLU6Exl5sg1wYw9VeKkSpG0rLpSsTadow69PeYxwhTyi9Z mVxQ== X-Gm-Message-State: ALoCoQkz1f3AazbwKj3W+PKLJkpz64bU4iXbA3dGVDIObfMwYyLI2rj90qu1Jtkfm+iD/Kz4PmcIDOFbHnSeCVkHPMBOYCDXnNc4QNGbQIPn/owUUyBb+u3CY7BCBBX7+Tf9DMzIbf8l MIME-Version: 1.0 X-Received: by 10.180.211.161 with SMTP id nd1mr19549585wic.41.1389717902901; Tue, 14 Jan 2014 08:45:02 -0800 (PST) Received: by 10.227.91.198 with HTTP; Tue, 14 Jan 2014 08:45:02 -0800 (PST) In-Reply-To: References: Date: Tue, 14 Jan 2014 20:45:02 +0400 Message-ID: To: Julien Pauli Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a11c3818af0dc2d04eff0e952 Subject: Re: [PHP-DEV] New Memory Manager From: dmitry@zend.com (Dmitry Stogov) --001a11c3818af0dc2d04eff0e952 Content-Type: text/plain; charset=UTF-8 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. On Tue, Jan 14, 2014 at 6:50 PM, Julien Pauli wrote: > On Tue, Jan 14, 2014 at 3:21 PM, Dmitry Stogov wrote: > > Hi, > > > > Recently I took a look into jemalloc and tcmalloc internals and tried to > > borrow some ideas. You may check the result at > > https://github.com/dstogov/php-src/tree/xx_malloc. It's a dirty prove of > > concept implementation of New Memory Manager for PHP. It was tested only > on > > Linux, release, non-ZTS build. It misses support for debug mode and ZTS > > yet. The main advantage is small but consistent speed improvement on > > real-life applications. > > > > I would appreciate if you bench it vs vanilla PHP-5.6 on your > applications, > > review the code from performance and security points of views, and come > > with comments, ideas and criticism. (For example: may be someone would > > suggest how to avoid check for USE_ZEND_ALLOC=0 to allow system malloc() > > usage on each emalloc() call? How to reduce cost of statistics > collection?) > > > > Currently, I'm not sure if 5% speed improvements costs the effort. > > > > The results of my benchmarks follow. > > > > Thanks. Dmitry. > > > > *PHP-5.6 32-bit* zend_alloc xx_malloc Improvement blog 105.6 109.7 > > 3.88% drupal > > 1625.0 1667.6 2.62% fw 231.6 286.4 23.66% hello 12048.4 11865.9 -1.51% > qdig > > 464.4 495.3 6.65% typo3 563.8 584.9 3.74% wordpress 188.9 196.8 4.19% > xoops > > 132.7 140.0 5.50% scrum 181.6 192.7 6.11% ZF1 Hello 1153.2 1228.4 > 6.52% ZF2 > > Test 263.0 275.5 4.75% > > Great Dmitry ! > > We worked on something with Joe few months ago, mainly adding a new > ZendMM handler which binds jemalloc(). > > Anyway, I'm gonna try your code and run it against several Symfony2 > applications. > I come back to you end of week with some results ;-) > > Julien > --001a11c3818af0dc2d04eff0e952--