[php-src] PR #12539: fix: don't delete an unitialized timer
| From: | dunglas | Date: | Fri, 27 Oct 2023 16:18:06 +0000 |
| Subject: | [php-src] PR #12539: fix: don't delete an unitialized timer | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-24012@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12539
Author: dunglas
This patch significantly improves performance by allowing reusing timers instead of creating and
deleting them at every request. With this patch, PHP does only 2 syscalls per thread (a thread can
handle many requests sequentially) instead of 2 per request.
As PHP doesn't manage threads itself, calling
zend_max_execution_timer_shutdown()
when a thread is terminated will now be the responsibility of the caller. I think that this change
is acceptable because threads are often used to handle requests until the process terminates
(it's what FrankenPHP does for instance), so even if
zend_max_execution_timer_shutdown() isn't called explicitly (which is better and
should be done by SAPIs using threads), the OS will destroy the timers when after the process
termination.
cc @arnaud-lb