Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71121 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93076 invoked from network); 14 Jan 2014 14:22:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2014 14:22:01 -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.178 cause and error) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.212.178 mail-wi0-f178.google.com Received: from [209.85.212.178] ([209.85.212.178:53353] helo=mail-wi0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/51-18860-60845D25 for ; Tue, 14 Jan 2014 09:22:00 -0500 Received: by mail-wi0-f178.google.com with SMTP id cc10so771883wib.11 for ; Tue, 14 Jan 2014 06:21:55 -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=CAn3wxpZO3CAJ2Ge0hWuoRcwOWErVVB4F0c7DrU2d10=; b=NS7D0dItXfNYS015rsXeDECN1OYooyArmV/I5eFTMoiYkVFvxz1+MutiRVQiZYLOcb mpKEwdqDg38zup+RlS7DOjXMCR+9DmXlw1XCs56oBXd0E9It/dnBV0QZ5+JsI/n60H0C goG2pXxXoP0g7GutDE9zt9LkP1YxJ6YM9zcI2sA++Ir+j0UJVZHOKSnyY5UYw6DgS3Zi Z4zmLIdiOQWoW+PAa9CMHgdQZsXMazMl0I+oDO2AzILpUR7ignvUJplMZwZFWtuffljF /ta3NCRgDYZ29g30tw17uvzqbP9rUsEy0xUfWiiR3YBqTvdBa7jBYn3XshYlOOfaneMQ Fbxg== X-Gm-Message-State: ALoCoQk2cg0zam/BdSFLrY8QkZJ9NROHEzzK1Q3Fw0CyqW5QbYI0cs7PO/WAdf47jIPE6SHWUOT+Qp5SK4Nb9FLGnO1P9lpOqAeElj84AadE1W8mba/to5sMybPmeU7WanblRScgOzhC MIME-Version: 1.0 X-Received: by 10.194.92.68 with SMTP id ck4mr27964915wjb.53.1389709312530; Tue, 14 Jan 2014 06:21:52 -0800 (PST) Received: by 10.227.91.198 with HTTP; Tue, 14 Jan 2014 06:21:52 -0800 (PST) Date: Tue, 14 Jan 2014 18:21:52 +0400 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=047d7bf0d2deea31b804efeee993 Subject: New Memory Manager From: dmitry@zend.com (Dmitry Stogov) --047d7bf0d2deea31b804efeee993 Content-Type: text/plain; charset=UTF-8 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% --047d7bf0d2deea31b804efeee993--