I'm running XAMPP 1.7.1 on Windows 7 Ultimate. Everything (Apache & MySQL) is working fine except for speed.
When I open http://localhost/, I must wait probably 1-3 seconds for view a webpage. In my opinion, it should be at most some hundreds miliseconds.
Basic facts:
- while waiting to load a localhost webpage, status bar says "Waiting for localhost..."
- CPU is still idle (no increased activity while loading)
- on localhost is no demanding PHP scripts, problems are when there is simple phpinfo() even if there is long heavy scripts.
- disabling MySQL server don't affect speed
- my PC: AMD Turion 64 X2; 1,6 GHz dual-core, 2 GB RAM, 100 GB HDD
I've made a little simple benchmark PHP script to test HDD/CSS speeds:
<?php
function getmicrotime() {
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
function testReadWrite() {
$timeStart = getmicrotime();
$filename = "test.txt";
file_put_contents( $filename, '' ); // prepare empty file
for ( $i = 0; $i < 1000; $i++ ) {
$a = file_get_contents( $filename );
file_put_contents( $filename, $a . '.' );
}
return round( getmicrotime() - $timeStart, 3 );
}
function testCpuSpeed() {
$timeStart = getmicrotime();
$var = '';
for ( $i = 0; $i < 100000; $i++ ) {
$var = sha1( md5( $i * $i * $i * $i * $i * $i * $i * $i * $i * $i ) );
}
return round( getmicrotime() - $timeStart, 3 );
}
echo "Read/write #1: " . testReadWrite() . "<BR>";
echo "Read/write #2: " . testReadWrite() . "<BR>";
echo "Read/write #3: " . testReadWrite() . "<BR>";
echo "CPU speed #1: " . testCpuSpeed() . "<BR>";
echo "CPU speed #2: " . testCpuSpeed() . "<BR>";
echo "CPU speed #3: " . testCpuSpeed() . "<BR>";
?>
My PC results:
- Read/write: 5.134 / 3.431 / 3.494
- CPU speed: 0.816 / 0.767 / 0.795
A webhosting results:
- Read/write: 7.768 / 7.69 / 7.371
- CPU speed: 0.232 / 0.234 / 0.234
One of my server's results (as idle computer nearly as my PC, but a little bit faster):
- Read/write: 0.088 / 0.168 / 0.185
- CPU speed: 0.191 / 0.189 / 0.189
So I don't think that it is because of my PC speed, but I'm sure that there's some another problem. Do you have some experience with XAMPP speed on Windows 7 (or Vista) ?
Thanks.