php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #70497 Unnecessary HANDLE_BLOCK_INTERRUPTIONS leads to slowdown
Submitted: 2015-09-15 04:01 UTC Modified: 2016-12-17 14:42 UTC
From: dja at axtens dot net Assigned: nikic (profile)
Status: Closed Package: Performance problem
PHP Version: 5.6Git-2015-09-15 (Git) OS: All
Private report: No CVE-ID: None
 [2015-09-15 04:01 UTC] dja at axtens dot net
Description:
------------
Currently, HANDLE_BLOCK_INTERRUPTIONS and HANDLE_UNBLOCK_INTERRUPTIONS are used  either for ZEND_SIGNAL support, or to call out to the zend utility functions struct to call a SAPI-specific function.

However, the only SAPIs that populates those functions in the utility struct are the obsolete Apache 1 SAPIs: in all other cases the function pointer is NULL. As such, when ZEND_SIGNAL is off, we can actually remove the conditional branch entirely.
    
This leads to a speed up on PHP5 code. I've measured the performance
impact on a PowerPC 64-bit little-endian system and on a x86_64 laptop
using the test script below.    

I see a ~6% improvement in performance on POWER and a ~4% improvement
on x86_64.
    
I also see an improvement in a e-commerce web application on POWER
with this change.

I've submitted this change as a pull request on GitHub.

Test script:
---------------
    <?php
    for ($i=1; $i < 100000000; $i++) {
            $genericObject = new stdClass();
            $a = (object) 8;
            $b = (object) 'abcde';
    }
    ?>


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-17 14:42 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2016-12-17 14:42 UTC] nikic@php.net
Closing here, as this is gone in PHP 7 and (per the linked PR) the 5.6 RMs decided not to change this in PHP 5.6.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC