]> granicus.if.org Git - php/commit
Improve performance of PowerPC64 fast_long_increment_function
authorAnton Blanchard <anton@samba.org>
Tue, 26 May 2015 13:06:12 +0000 (23:06 +1000)
committerRemi Collet <remi@php.net>
Tue, 28 Jul 2015 16:38:23 +0000 (18:38 +0200)
commit4d578f28df214c5faf115d3a629f9ffe82640b2b
tree7d7420343987c5785e88c7777806e93ede0e2023
parent305199a13163e246b909ef32880df032823bff05
Improve performance of PowerPC64 fast_long_increment_function

Detecting overflow with the XER is slow, partially because we have to
clear it before use.

gcc does a better job of detecting overflow of an increment or decrement
than we can with inline assembly. It knows that an increment will only
overflow if it is one less than the overflow value. This means we end
up with a simple compare/branch. Furthermore, leaving it in c allows gcc
to schedule the instructions better.

This is 6% faster on a POWER8 running a simple testcase:

<?php
        function testcase($count = 100000000) {
$x = 1;
                for ($i = 0; $i < $count; $i++) {
                        $x++;
                        $x++;
                        $x++;
                        $x++;
                        $x++;
                }
        }

        testcase();
?>
Zend/zend_operators.h