[PATCH] - Avoid invoking setitimer when timeouts have been disabled

From: Date: Fri, 30 Oct 2009 10:12:47 +0000
Subject: [PATCH] - Avoid invoking setitimer when timeouts have been disabled
Groups: php.internals 
Request: Send a blank email to internals+get-45908@lists.php.net to get a copy of this message
When compiled with #ifdef ZTS, the setitimer calls in zend_unset_timeout show up as a performance hotspot even when I'd set max_execution_time and max_input_time to 0 in php.ini. I've attached a patch for review that avoids invoking zend_unset_timeout (and thereby the expensive setitimer call within) when timeouts have been disabled via settings in php.ini Thanks, Arvi

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
« previous php.internals (#45908) next »