#50086 [NEW]: [PATCH] - Avoid invoking setitimer when timeouts have been disabled

From: Date: Thu, 05 Nov 2009 09:11:19 +0000
Subject: #50086 [NEW]: [PATCH] - Avoid invoking setitimer when timeouts have been disabled
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-144284@lists.php.net to get a copy of this message
From: yoarvi at gmail dot com Operating system: Solaris 5.10 (SPARC) PHP version: 6SVN-2009-11-05 (SVN) PHP Bug Type: Performance problem Bug description: [PATCH] - Avoid invoking setitimer when timeouts have been disabled Description: ------------ When compiled with #ifdef ZTS, the setitimer calls in zend_unset_timeout show up as a performance hotspot even when max_execution_time and max_input_time are set to 0 in php.ini. (Originally posted to the internals list - http://marc.info/?l=php-internals&m=125689761124706&w=2) Reproduce code: --------------- The following patch avoids invoking zend_unset_timeout (and thereby the expensive setitimer call within) when timeouts have been disabled via settings in php.ini diff -r d0dddebae3a2 main/main.c --- a/main/main.c Mon May 04 18:11:50 2009 +0200 +++ b/main/main.c Fri Aug 28 17:35:25 2009 +0530 @@ -1602,7 +1602,9 @@ } zend_end_try(); zend_try { - zend_unset_timeout(TSRMLS_C); + if (EG(timeout_seconds) != 0) { + zend_unset_timeout(TSRMLS_C); + } } zend_end_try(); } @@ -1702,7 +1704,9 @@ /* 12. Reset max_execution_time */ zend_try { - zend_unset_timeout(TSRMLS_C); + if (EG(timeout_seconds) != 0) { + zend_unset_timeout(TSRMLS_C); + } } zend_end_try(); #ifdef PHP_WIN32 Expected result: ---------------- Improved multi-threaded performance. -- Edit bug report at http://bugs.php.net/?id=50086&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50086&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50086&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50086&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50086&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50086&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50086&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50086&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50086&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50086&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50086&r=support Expected behavior: http://bugs.php.net/fix.php?id=50086&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50086&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50086&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50086&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50086&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50086&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50086&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50086&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50086&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50086&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50086&r=mysqlcfg

« previous php.bugs (#144284) next »