Req #71932 [Opn->Fbk]: Low performance with bit operation
| From: | danack@php.net | Date: | Thu, 31 Mar 2016 23:03:41 +0000 |
| Subject: | Req #71932 [Opn->Fbk]: Low performance with bit operation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200275@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71932&edit=1
ID: 71932
Updated by: danack@php.net
Reported by: jacky at xsteach dot com
Summary: Low performance with bit operation
-Status: Open
+Status: Feedback
Type: Feature/Change Request
Package: Performance problem
Operating System: Mac OS X 10.11
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Please do performance measuring without xdebug enabled. There are no guarantees about performance
when it is enabled.
Additionally, I'm unable to replicate what you are seeing, Running the test script on https://3v4l.org/kDYv3 gives consistently faster performance for
PHP 7. Example values are:
Output for 7.0.5
Done in 0.048620939254761 seconds
Output for 5.6.19
Done in 0.078345060348511 seconds
Output for 5.5.33
Done in 0.065199851989746 seconds
Previous Comments:
------------------------------------------------------------------------
[2016-03-31 10:59:41] jacky at xsteach dot com
Description:
------------
Bit operation on php 5.6+ is lower performance than php 5.5-.
php5.5 is faster 3x+ than php5.6 and php7.0.
$ php5 -v
PHP 5.5.31 (cli) (built: Feb 20 2016 20:33:10)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
$php5 demo.php
Done in 0.047697067260742 seconds
$ php -v
PHP 5.6.19 (cli) (built: Mar 6 2016 14:18:03)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Retinas
$ php demo.php
Done in 0.15873312950134 seconds
$ php7 -v
PHP 7.0.4 (cli) (built: Mar 6 2016 14:30:59) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.0RC4-dev, Copyright (c) 2002-2015, by Derick Rethans
$ php7 demo.php
Done in 0.10964512825012 seconds
Test script:
---------------
<?php
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
$i = 1920 * 1080;
$a = 1;
while ($i--) {
$a << 1;
}
$time_end = microtime_float();
$time = $time_end - $time_start;
echo "Done in $time seconds\n";
Expected result:
----------------
Bit operation on php7.0 as faster as php5.5 or even better.
Actual result:
--------------
Low performance with bit operation on php7.0.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71932&edit=1