Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22367 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3528 invoked by uid 1010); 13 Mar 2006 12:12:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 3513 invoked from network); 13 Mar 2006 12:12:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Mar 2006 12:12:44 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:37763] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 38/57-55982-AB165144 for ; Mon, 13 Mar 2006 07:12:43 -0500 Received: (qmail 1354 invoked from network); 13 Mar 2006 12:12:39 -0000 Received: from internal.zend.office (HELO thinkpad) (10.1.1.1) by internal.zend.office with SMTP; 13 Mar 2006 12:12:39 -0000 To: "'Rasmus Lerdorf'" , "'internals'" Date: Mon, 13 Mar 2006 15:12:01 +0300 Message-ID: <000001c64697$5936afc0$6e02a8c0@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 Importance: Normal In-Reply-To: <4414F63F.5030406@lerdorf.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 Subject: RE: [PHP-DEV] Calling performance geeks From: dmitry@zend.com ("Dmitry Stogov") References: <4414F63F.5030406@lerdorf.com> Hi Rasmus, I made two improvements in 5.1 and run the same bechmarks on Intel = Pentium M 1.5GHz 2M cache. top/top5/top10 =09 php-5.1 740 550 430 req/sec php-4.4 680 440 290 req/sec May be the problem is AMD chip? :) Thanks. Dmitry. > -----Original Message----- > From: Rasmus Lerdorf [mailto:rasmus@lerdorf.com]=20 > Sent: Monday, March 13, 2006 7:34 AM > To: internals > Subject: [PHP-DEV] Calling performance geeks >=20 >=20 > We have a bit of a performance disconnect between 4.4 and 5.1=20 > still. I=20 > was doing some benchmarking today just as a sanity check on some APC=20 > work I have been doing lately and came up with this: >=20 > http://lerdorf.com/php/bm.html >=20 > You can ignore the apc/eaccelerator stuff. Those numbers are not=20 > surprising. The surprising number to me is how much faster=20 > 4.4 still is. >=20 > The graph labels are slightly off. The 0, 5 and 10 includes should=20 > really be 1, 6 and 11. The actual benchmark code is here: >=20 > http://www.php.net/~rasmus/bm.tar.gz >=20 > Tested on a Linux 2.6 Ubuntu box on an AMD chip (syscalls are cheap=20 > there) with current PHP_4_4 and PHP_5_1 checkouts. Was also testing=20 > 5.1.2 to see the effect of getting rid of that uncached realpath call. >=20 > As far as I can tell auto_globals_jit isn't working at all, but I=20 > eliminated that by doing variables_order =3D GP for these benchmarks.=20 > Even so, the request_startup is significantly more expensive in 5.1. >=20 > Here are callgrind dumps for each. Load them up with kcachegrind and=20 > browse around: >=20 > PHP 4.4 http://www.php.net/~rasmus/callgrind.out.1528.gz > PHP 5.1 http://www.php.net/~rasmus/callgrind.out.1488.gz >=20 > Each of these is 1000 requests against the top.php and=20 > 4top.php scripts.=20 > from bm.tar.gz. If you start at the >=20 > The script is trivial and looks like this: >=20 > > $base_dir =3D '/var/www/bm/'; > include $base_dir . 'config.inc'; >=20 > function top_func($arg) { > $b =3D $arg.$arg; > echo $b; > } > class top_class { > private $prop; > function __construct($arg) { > $this->prop =3D $arg; > } > function getProp() { > return $this->prop; > } > function setProp($arg) { > $this->prop =3D strtolower($arg); > } > } >=20 > top_func('foo'); > $a =3D new top_class('bar'); > echo $a->getProp(); > $a->setProp("AbCdEfG"); > echo $a->getProp(); > echo << The database is {$config['db']} > and the user is {$config['db_user']} >=20 > EOB; > ?> > >=20 > and config.inc is: >=20 > $config =3D array( > 'db' =3D> 'mysql', > 'db_user' =3D> 'www', > 'db_pwd' =3D> 'foobar', > 'config1' =3D> 123, > 'config2' =3D> 456, > 'config3' =3D> 789, > 'sub1' =3D> array(1,2,3,4,5,6,7,8,9,10), > 'sub2' =3D>=20 > array("abc","def","ghi","jkl","mno","pqr","stu","vwx","yz") > ); > ?> >=20 > 4top.php is identical except for the class definition being=20 > PHP 4-style=20 > instead. As in no private and a PHP 4 constructor. Otherwise it is=20 > identical. >=20 > I have some ideas for things we can speed up in 5.1. Like,=20 > for example,=20 > we should add the ap_add_common_vars() and ap_add_cgi_vars()=20 > to the jit=20 > mechanism. There isn't much point filling these in unless the script=20 > tries to get them. the ap_add_common_vars() call is=20 > extremely expensive=20 > since it does a qsort with a comparison function that uses=20 > strcasecmp.=20 > Of course, this same optimization can be done in 4.4. >=20 > If you know your way around kcachegrind, load up the two=20 > callgrind files=20 > and see what stands out for you. As far as I can tell, while=20 > we can do=20 > some tricks to speed up various helper bits, the slowdown is=20 > coming from=20 > the executor trashing its cache lines. >=20 > -Rasmus >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20 >=20 >=20