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
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php