#50086 [Opn->Csd]: [PATCH] - Avoid invoking setitimer when timeouts have been disabled

From: Date: Thu, 05 Nov 2009 10:39:30 +0000
Subject: #50086 [Opn->Csd]: [PATCH] - Avoid invoking setitimer when timeouts have been disabled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-144286@lists.php.net to get a copy of this message
ID: 50086 Updated by: dmitry@php.net Reported By: yoarvi at gmail dot com -Status: Open +Status: Closed Bug Type: Performance problem Operating System: Solaris 5.10 (SPARC) PHP Version: 6SVN-2009-11-05 (SVN) New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2009-11-05 09:11:18] yoarvi at gmail dot com 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 this bug report at http://bugs.php.net/?id=50086&edit=1

« previous php.bugs (#144286) next »