#45942 [NEW]: D_FILE_OFFSET_BITS=64 causes PHP to run at half speed
| From: | jhuckaby at gmail dot com | Date: | Thu, 28 Aug 2008 17:36:38 +0000 |
| Subject: | #45942 [NEW]: D_FILE_OFFSET_BITS=64 causes PHP to run at half speed | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-128502@lists.php.net to get a copy of this message | ||
From: jhuckaby at gmail dot com
Operating system: Fedora Core 6
PHP version: 5.2.6
PHP Bug Type: Performance problem
Bug description: D_FILE_OFFSET_BITS=64 causes PHP to run at half speed
Description:
------------
Compiling PHP with -D_FILE_OFFSET_BITS=64 causes the PHP interpreter
to run at approximately half speed. This includes basic math
operations (no file reading/writing necessary to reproduce).
Output from script with PHP 5.2.6 compiled with the default 32 bit
file offsets:
[root@dev-ops buildscripts]# /ipix/php/bin/php ~/benchmark.php
CPU Benchmark: 319
Output from script with PHP 5.2.6 compiled with -
D_FILE_OFFSET_BITS=64:
[root@dev-ops buildscripts]# /ipix/php/bin/php ~/benchmark.php
CPU Benchmark: 153
Please note this number represents the number of iterations through
the loop in 1 second of runtime, so larger numbers are faster.
I have reproduced the same behavior with the bleeding edge CVS daily
snapshot (php5.2-200808281630) and latest 5.2.6 stable, as well as
5.2.4 stable.
My ./configure line:
CFLAGS="-D_FILE_OFFSET_BITS=64" ./configure --with-pgsql=/ipix/pgsql -
-enable-ftp --with-zlib --enable-shmop --enable-sysvsem --enable-
sysvshm --enable-sysvmsg --enable-pcntl --enable-mbstring --with-xsl -
-with-curl --with-curlwrappers --without-mysql --with-ldap --with-
ldap-sasl --with-apache=../apache_1.3.39 --prefix=/ipix/php --with-
config-file-path=/ipix/php/lib
Simply removing the CFLAGS="-D_FILE_OFFSET_BITS=64" doubles the speed
of the test script.
Reproduce code:
---------------
<?php
$start_time = microtime(true);
$done = 0;
$count = 0;
while (!$done) {
for ($idx = 0; $idx < 10000; $idx++) {
$x = 45 * 67 / 2 + $idx - 239892382.23232323;
$y = 3483434.33483 / 28328372 * 384 + $idx - $x;
}
$count++;
$now = microtime(true);
if ($now - $start_time >= 1.0) { $done = 1; }
}
print "CPU Benchmark: $count\n";
?>
Expected result:
----------------
[root@dev-ops buildscripts]# /ipix/php/bin/php ~/benchmark.php
CPU Benchmark: 319
The output of the script should be nearly identical whether the
D_FILE_OFFSET_BITS is set to 64 or not.
The benchmark number is the number of iterations through the loop that
was achieved in 1 second of runtime, so larger numbers are faster.
Actual result:
--------------
[root@dev-ops buildscripts]# /ipix/php/bin/php ~/benchmark.php
CPU Benchmark: 153
(This is about half the speed it should be -- larger numbers are better,
as this is a count of the iterations for one second of runtime.)
--
Edit bug report at http://bugs.php.net/?id=45942&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45942&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45942&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45942&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45942&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=45942&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45942&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45942&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45942&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45942&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45942&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=45942&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=45942&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45942&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45942&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45942&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45942&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45942&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45942&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45942&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45942&r=mysqlcfg