Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73895 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9966 invoked from network); 5 May 2014 14:25:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 May 2014 14:25:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=andi@zend.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=andi@zend.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 209.85.213.51 cause and error) X-PHP-List-Original-Sender: andi@zend.com X-Host-Fingerprint: 209.85.213.51 mail-yh0-f51.google.com Received: from [209.85.213.51] ([209.85.213.51:58631] helo=mail-yh0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/63-23541-44F97635 for ; Mon, 05 May 2014 10:25:10 -0400 Received: by mail-yh0-f51.google.com with SMTP id f10so2304249yha.10 for ; Mon, 05 May 2014 07:25:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=qxEJdB8oiWaCezQMmyXzqF1J+gkHdcguS3uy9eYPIlg=; b=jNU03bWCi0r4ky8Rfx3IUEQ0nobmf29CjNRkGKcBiFwhzO5PyjkwPBiayyRyiGZ1Tt kkEUb8289Qh+JVhh3t3BCMat6I43EiVzLj7MDdNRWmSGo0z2a17Z3SHs8aScghGErMA8 8hw1Q3PqHMI4k8p2MhP/c3Cw/rSuZuM5QskEuPcwe9AmAVVtmBu94YodLs3P9iAj3xxa reS9RApAmI3mEO5scCQmR3Y3hSvIdsGlM9LfoZQeMZwso4uj8WNaKV2U4QtRQPzfQLWx 17Lbzkfvpb87ARXjc83aWjJEzW8cGGw9tz4J3xsdAv6TSdAZeTC5TlbitP9ITE8fQCyW 092Q== X-Gm-Message-State: ALoCoQnbLDjNiD75bruuPiYqV1qoLHHgBhnSWg5ci/We01ByvIJ8wD5FUEQrWv6IRe1jBJWtG4bMG9+guLTh6V5nGUZoqs5GSYi2LzoVHmucETKFkTNTPUYHQJwhPmnhOehvwO6iaptQ X-Received: by 10.236.126.43 with SMTP id a31mr48115022yhi.154.1399299894729; Mon, 05 May 2014 07:24:54 -0700 (PDT) Received: from [10.1.242.173] ([74.121.220.2]) by mx.google.com with ESMTPSA id x4sm15855438yhh.0.2014.05.05.07.24.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 07:24:54 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) In-Reply-To: <139CBA89-9FBD-44E9-A4FC-5539F02943BC@googlemail.com> Date: Mon, 5 May 2014 07:24:53 -0700 Cc: Dmitry Stogov , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <828B5A86-5E7B-404F-A1F3-BCA2D3B7514F@zend.com> References: <139CBA89-9FBD-44E9-A4FC-5539F02943BC@googlemail.com> To: Kevin Ingwersen X-Mailer: Apple Mail (2.1874) Subject: Re: [PHP-DEV] phpng: Refactored PHP Engine with Big Performance Improvement From: andi@zend.com (Andi Gutmans) Hi Kevin, The Zend Engine for many years now has been an integral part of the PHP = source tree and enjoys contributors from all over the community (not = just Zend).=20 This refactoring exercise doesn=92t change any of that and as Dmitry = mentioned, is really a refactoring of the Zend Engine vs. a new thing. = This started as experimental work and once we figured it was a great, = viable direction to head in we decided to share it. It does have = implications for PHP extensions because we made changes to the datatype = structures, etc. but it=92s been relatively straightforward to update = the various extensions to conform to the refactored structures. The benefits do seem to be massive (exceeding our initial expectations). = Memory usage is *significantly* down, overall performance impact on = real-world apps is significant and with these changes it=92s opened up a = lot of additional opportunities for further optimization down the road = as we are not bottlenecked by our data structures. Andi On May 5, 2014, at 7:07 AM, Kevin Ingwersen = wrote: > Hey! >=20 > This sounds like an amazing bit of updatng! :) I am very much looking = forward to the new release of PHP. But, there is soemthing I do not = understand. >=20 > I know that Zend is the current underlying VM, and further, this is = not actual work by the PHP team=85am I right? > Further, will phpng replace the vm, or even more parts? Will it still = need components like TSRM? >=20 > I am just asking, as I have been working with PHP within embedded = aplications for a while now (currently working on porting autoconf to = cDetect). If parts of the source tree structure changed, I would need = to refactor the building part as well. >=20 > Also, I am currently running a rather small but active community. To = test phpng, I was thinking about silently injecting it thru the cgi = script, to see how the performance owuld change. Does phpng have any = effects on currently existing extensions (PDO, memcached)? >=20 > Kind regards, Ingwie! > Am 05.05.2014 um 15:07 schrieb Dmitry Stogov : >=20 >> For people who know me it's not a secret that PHP performance is my = main >> responsibility and passion at Zend. Actually, starting from PHP 5.0 = we >> already made 6 times speedup on synthetic benchmarks and about 2 = times >> speedup on real-life applications. We endlessly made improvements in = PHP >> engine and OPCache. However, by PHP 5.5 release we weren=92t be able = to make >> any serious progress, and among other things started to experiment = with >> memory managers, JIT technologies and other potential ideas. >>=20 >> I spent a significant amount of time experimenting with JIT, and even >> created a PoC of transparent LLVM based JIT compiler embedded into = OPCache. >> The results on bench.php was just amazing =96 (0.219 seconds against = 2.175 =96 *10 >> times speedup of PHP 5.5*), but on real-life apps we got just few = percent >> speedup. This made us look much deeper into some of the runtime >> characteristics and what was truly the bottleneck to making more >> substantial progress. It was clear the VM is already highly = optimized, but >> works with data structures that require endless memory allocation, >> deallocation and reference counting. Typical real-life PHP = application >> spends about 20% of the CPU time in memory manager, 10% doing hash = tables >> operations, 30% in internal functions and only 30% in VM. Of course, = we >> tried to JIT only VM code and in most cases it had to perform the = same >> memory allocations. So we decided to change focus and work on the big >> bottlenecks. The idea was to change our data types to minimize heap >> allocations. This was a very difficult decision because we had to = start >> with a huge refactoring, and we had no idea whether it=92s going to = have any >> impact or not. >>=20 >> Now I'm glad to present you a result of our recent four month work. = It's a >> refactoring of the PHP engine that significantly improves = performance, >> memory usage and builds a foundation for a lot more future = performance >> improvements incl. JIT. I'll avoid technical details (more details = will be >> published at *http://wiki.php.net/phpng = *), but >> in few words - we changed the basement trying to keep most of the = building >> unchanged. Right now the new engine already makes *10-30% speedup of >> php*not only on benchmarks but on real-life applications as well! >>=20 >> *Some benchmarks we ran so far:* >>=20 >> Wordpress 3.6 =96 20.0% gain (253 vs 211 req/sec) >>=20 >> Drupal 6.1 =96 11.7% gain (1770 vs 1585 req/sec >>=20 >> Qdig =96 15.3% gain (555 vs 482 req/sec) >>=20 >> ZF test app =96 30.5% gain (217 vs 166 req/sec) >>=20 >> On some apps we show better results than other PHP implementations. = It will >> be great if others here could test this on their apps and compare to = their >> existing PHP version to get additional results. >>=20 >> The re-factoring is not finished yet as the focus was to first test = whether >> this effort would deliver results. Not all extensions are supported, = some >> tests are failing, and we also have more ideas for additional = improvement. >>=20 >> But =04we feel, we=92ve proven enough out to open it up for review, = feedback >> and assistance, and wanted to involve the community as soon as we = managed >> to get on a promising direction. There=92s more work to do in = finishing >> support of all extensions and continue to make some additional engine >> improvements. >>=20 >> =05Please try the refactored PHP engine and provide feedback re: = performance, >> memory usage and any issues that come up. You may find it in *phpng* = branch >> at *php.net *. Some instructions may be found at >> *http://wiki.php.net/phpng >> *. As mentioned, there are some missing >> extensions so not everything will run. >>=20 >> I would like to say many thanks to Xinchen and Nikita who made = significant >> part of presented work. >>=20 >> I think that this engine can make the new major version of PHP we=92re >> talking about a lot more interesting. >>=20 >> Thanks. Dmitry. >=20 >=20 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20