From: mark dot pearson at capita dot co dot uk
Operating system: Windows Server 2003
PHP version: 5.1.6
PHP Bug Type: Performance problem
Bug description: including a file is slower than expected
Description:
------------
Having recently set up a Windows Server 2003 web development server it has
been found that file access by way of PHP 'include' is much slower than it
should be when compared to other platforms.
A small benchmark script (included) was run on four different platforms
(none of them production servers), using both PHP4 and PHP5 as described
below:
PLATFORM 1
----------
System:
Microsoft Windows XP
Professional
Version 2002
Service Pack 2
Computer:
Intel(R) Pentium(R) M processor 1600MHz
589 MHz, 512 MB of RAM
PHP versions tested:
4.4.4 and 5.2 2006-09-13 snapshot
PLATFORM 2
----------
System:
Microsoft Windows Server 2003
Enterprise Edition
Service Pack 1
Computer:
Intel(R) Xeon(TM) CPU 2.80GHz
2.80Ghz, 2.00GB of RAM
Physical Address Extension
PHP versions tested:
4.4.4 and 5.2 2006-09-13 snapshot
PLATFORM 3
----------
System:
Microsoft Windows Server 2003
Standard Edition
Service Pack 1
Computer:
Intel(R) Xeon(TM) CPU 3.00GHz
3.00Ghz, 3.50GB of RAM
PHP versions tested:
4.4.4 and 5.1.6
PLATFORM 4
----------
Fedora Core 4
Pentium 3 760MHz
256MB of RAM
4.3.11
The benchmark script was run 6 times on each platform.
Reproduce code:
---------------
benchmark.php
-------------
<?php
$tmp = split(" ",microtime());
$start = $tmp[0] + $tmp[1];
for ($i = 0; $i < 5000; $i++){
include 'emptyfile.php';
}
$tmp = split(" ",microtime());
$end = $tmp[0] + $tmp[1];
print "Elapsed time: " . ($end - $start) . "\n";
?>
emptyfile.php
-------------
<?php ?>
Expected result:
----------------
I would expect the benchmark.php script to run more quickly on both
PLATFORM 2 and PLATFORM 3 (both of which are high spec servers running
Windows 2003 Server) than on PLATFORM 1 (a Compaq nx7010 laptop running
Windows XP Pro) or PLATFORM 4 (a Dell Optiplex GX110 running Fedora Core
4).
Actual result:
--------------
The script completed more quickly even on PLATFORM 4 (Pentium 3 730MHz
256MB RAM) than on PLATFORM 2 and 3
The results are included below:
PLATFORM 1 - with no other apps running
=======================================
PHP 4.3.11
----------
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.87640404701233
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.89498400688171
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.98714590072632
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.92531800270081
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.94181489944458
>C:\php4\cli\php.exe -n benchmark.php
Elapsed time: 0.92592406272888
PHP 5.2 (2006-09-13 snapshot)
-----------------------------
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.6999979019165
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.61439085006714
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.66567397117615
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.61945104598999
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.64544701576233
>C:\php5\php.exe -n benchmark.php
Elapsed time: 0.60436511039734
PLATFORM 2 - With no other apps running
=======================================
PHP 4.4.4
---------
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.6818718910217
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.6455881595612
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.6652920246124
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.8808929920197
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.7031700611115
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 2.6331689357758
PHP 5.2 (2006-09-13 snapshot)
-----------------------------
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.5149850845337
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.5081758499146
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.5118081569672
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.5036170482635
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.500696182251
>D:\PHP\php.exe -n benchmark.php
Elapsed time: 1.5246729850769
PLATFORM 3 - With no other apps running
=======================================
PHP 5.1.6
---------
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.79046392440796
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.79226303100586
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.78908896446228
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.79035115242004
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.78956294059753
>C:\PHP\php.exe -n benchmark.php
Elapsed time: 0.78894019126892
PHP 4.4.4
---------
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.2411949634552
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.2386450767517
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.2364308834076
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.23734998703
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.2394840717316
>D:\php-4.4.4-Win32\cli\php.exe -n benchmark.php
Elapsed time: 1.2390379905701
PLATFORM 4 - with no other apps running
=======================================
PHP 4.3.11 (cli) (built: Nov 15 2005 12:17:31)
----------------------------------------------
$ php -n benchmark.php
Elapsed time: 0.54825496673584
$ php -n benchmark.php
Elapsed time: 0.51459383964539
$ php -n benchmark.php
Elapsed time: 0.51424598693848
$ php -n benchmark.php
Elapsed time: 0.54676699638367
$ php -n benchmark.php
Elapsed time: 0.54855012893677
$ php -n benchmark.php
Elapsed time: 0.51129794120789
--
Edit bug report at http://bugs.php.net/?id=38825&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38825&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38825&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38825&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38825&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38825&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38825&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38825&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38825&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38825&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38825&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38825&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38825&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38825&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38825&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38825&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38825&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38825&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38825&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38825&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38825&r=mysqlcfg