Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71257 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58658 invoked from network); 18 Jan 2014 22:05:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jan 2014 22:05:04 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.50 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.50 mail-oa0-f50.google.com Received: from [209.85.219.50] ([209.85.219.50:45257] helo=mail-oa0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A3/22-46720-09AFAD25 for ; Sat, 18 Jan 2014 17:05:04 -0500 Received: by mail-oa0-f50.google.com with SMTP id n16so3146859oag.9 for ; Sat, 18 Jan 2014 14:05:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6Os32rPjvQkp2gR4aZhVAqTdniYoIbC5oVnbOTsHeKA=; b=HT9uwzB+bqNOenqVjOI0/n2af1ZysnTH/WkhXnNdeRnp5zlUvq4FjttHS5Buf5gkoe xuoqclVKAAEUoMVgM31yZ41DHdNmotk54rNgGouOCmC2/S3kEnCOU74n+Eu2XLBET8TD vELUsPfqdhw7LybO1qvHqUTgYRLxnNidXs4Ovipv6qIcLR9OzgAcFBfczUTm0o/QpECJ UZhEPLcImlefn6CIfcOEdX1m0a9nOUn+JQXeFuF1P5HMop1APfy8XvCKsHS9pLeFhfcK 97IitK6F0ORWUr4Ja2ahE901x7UFRC/v+skVpgKP1b1QvEPbLIA/zNNTaXDYYr8yC5Nm i/tw== MIME-Version: 1.0 X-Received: by 10.182.65.36 with SMTP id u4mr8126424obs.31.1390082701604; Sat, 18 Jan 2014 14:05:01 -0800 (PST) Received: by 10.182.54.112 with HTTP; Sat, 18 Jan 2014 14:05:01 -0800 (PST) In-Reply-To: References: Date: Sat, 18 Jan 2014 23:05:01 +0100 Message-ID: To: Dmitry Stogov Cc: PHP Internals Content-Type: multipart/alternative; boundary=047d7b604cbca33d6d04f045d961 Subject: Re: New Memory Manager From: nikita.ppv@gmail.com (Nikita Popov) --047d7b604cbca33d6d04f045d961 Content-Type: text/plain; charset=ISO-8859-1 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% > > > > > > > > *PHP-5.6 64-bit* zend_alloc xx_malloc Improvement blog 99.0 102.3 3.33% drupal > 1531.1 1604.2 4.78% fw 197.6 206.5 4.50% hello 11702.0 11875.2 1.48% qdig > 451.1 476.8 5.70% typo3 541.8 568.7 4.96% wordpress 176.5 185.8 5.27% xoops > 126.1 134.5 6.66% scrum 169.3 174.9 3.31% ZF1 Hello 1042.9 1119.6 7.35% ZF2 > Test 238.4 242.5 1.72% > I tested your patch on some parsing code (which is very heavy on object creation for syntax trees) and saw ~12% performance improvement and ~15% memory usage improvement there. So looks like the new allocator works particularly well if a lot of object allocation is involved. Nikita --047d7b604cbca33d6d04f045d961--