Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:231 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25472 invoked from network); 24 Mar 2003 20:06:59 -0000 Received: from unknown (HELO bimba.bezeqint.net) (192.115.106.39) by pb1.pair.com with SMTP; 24 Mar 2003 20:06:59 -0000 Received: from mr5.bezeqint.net (pip-17.bezeqint.net [192.115.106.17]) by bimba.bezeqint.net (Bezeq International SMTP out Mail Server) with ESMTP id AC4404607 for ; Mon, 24 Mar 2003 22:03:21 +0200 (IST) Received: from mail.zend.com (bzq-117-235-230.cust.bezeqint.net [192.117.235.230]) by mr5.bezeqint.net (Mirapoint Messaging Server MOS 3.2.2-GA) with SMTP id ADM47769; Mon, 24 Mar 2003 22:06:47 +0200 (IST) Received: (qmail 15635 invoked from network); 24 Mar 2003 20:06:39 -0000 Received: from localhost (HELO zeev-laptop.zend.com) (127.0.0.1) by localhost with SMTP; 24 Mar 2003 20:06:39 -0000 Reply-To: zeev@zend.com Message-ID: <5.1.0.14.2.20030324115627.048a5090@localhost> X-Sender: zeev@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Mon, 24 Mar 2003 12:04:59 -0800 To: wmeler@wp-sa.pl Cc: internals@lists.php.net In-Reply-To: <20030324135821.E31290@wp-sa.pl> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] ZTS performance From: zeev@zend.com (Zeev Suraski) References: <20030324135821.E31290@wp-sa.pl> ZTS is *always* going to be slower than non ZTS. There's no need for rewriting TSRM, it's roughly as fast as it can be. We may still be able to squeeze a bit more performance by reducing the number of fetches, but most fetches have already been eliminated, so I don't anticipate too much gains here. As Andi mentioned, about a year and a half ago we worked furiously to reduce the number of fetches. Most of those remaining are either too difficult to get rid of, or too ugly to get rid of. If people come up with patches that reduce the number of fetches, I'll be more than happy to go over them and commit them if they don't mess up the code too much... Note that only some of the slowdown is coming from fetches. Much of it is incurred by having to just do more - send extra arguments to virtually all function calls (when the context is passed, rather than fetched), having to calculate access to global elements in runtime instead of compile time, (CG(foo) resolves to a 'static' reference in non-ZTS, but a pointer based reference in ZTS), perform locking (very much reduced in modern versions of TSRM thanks to the Zeus guys) and use thread-safe system calls. Thread safety costs! Zeev At 04:58 24/03/2003, Wojtek Meler wrote: >Hi! > >I've done some performance tests of PHP with and without ZTS (RH7.2 - >pthreads). I've noticed that ZTS is signifcally slower than normal mode. My >machine was able to response for 100reqs/s without ZTS and 95reqs/s with ZTS. >When I turned on turck mmcache (code cache & optimizer) it handled 400reqs/s >without ZTS and 300reqs/s with ZTS. > >I think, that it is not mmcache problem, but ZE problem. Probably parsing cost >is similar in ZTS and normal mode, and it is so large that hide execution cost >difference in ZTS and nonZTS mode. That's why I got 100reqs/s in both ZTS and >nonZTS mode (that gives 10ms/request). > >Difference betwen 300 and 400 reqs/s is only 0.8ms. > >10% of it is mmcache (restoring from cache takes 0.14ms in nonZTS and >0.21ms in >ZTS). The rest is script execution overhead. > >Actually mmcache doesn't copy any opcodes - it only registers classes and >functions. The same code is called both in ZTS and nonZTS mode. Difference is >50% overhead in ZTS !!! > >Does anyone have any suggestions ? Maybe I should use different thread >library ? >Maybe TSRM should be rewritten ? >Does anyone have any similar results (with code caching) ? > >regards, >Wojtek > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php