Re: Why so FASTS on Windows? (was: Why so slow on Windows?)
| From: | John Bafford | Date: | Tue, 11 Feb 2014 14:37:28 +0000 |
| Subject: | Re: Why so FASTS on Windows? (was: Why so slow on Windows?) | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322817@lists.php.net to get a copy of this message | ||
On Feb 11, 2014, at 02:04, Umberto Salsi <salsi@icosaedro.it> wrote:
> The execution time dropped from 111 s to a fantastic, only 3.31 s!!!
> Now the comparison Linux/Windows is reversed:
>
> 1) Slackware Linux 12.1, Pentium 4, 32 bits, 1,6 GHz,
> PHP-CLI 5.3.6-dev:
> 26 s * 1.6 GHz = 42 Gcycles
>
> 2) Windows Vista Business, Pentium E5300, 32 bits 2.6 GHz,
> PHP-CLI 5.3.10-nts:
> 7.54 s * 2.6 GHz = 19.6 Gcycles
>
> Then the question now is: why so slow on Linux?
I would point out that gigacycles is actually not that great of a unit of measurement. You’re
comparing a Pentium 4 (from 2003, single core, with <= 512k L2 cache, and a 400 MHz FSB), to a
E5300 (from 2008, with two cores, 2 MB L2 cache, 800 MHz FSB, and even if PHP is running as 32-bit,
the chip itself is 64-bit).
Modern (last ~10 - 15 years) CPUs are measured in instructions per cycle, rather than cycles per
instruction, and can very easily execute multiple instructions per cycle (with great variability
depending on the particular instruction stream and memory access latency), and the general trend is
more instructions per cycle. Also, you may even have instruction set differences: the E5300 is a
64-bit cpu, and it’s possible the Windows build of Linux you’re using is complied to take
advantage of the new instructions despite still being a 32-bit process.
The E5300 is probably more than twice as fast per cycle. Being five years newer, it’s gone through
three process shrinks, from 130nm to 45nm, and likely that many architecture improvements. And
that’s just the CPU. There’s everything else on the motherboard that needs to be considered. At
a minimum, the E5300 has twice the bandwidth to RAM (and probably more of it), and that machine
probably has both faster disks and a faster interface to disk. There may also be other factors that
indirectly increase performance (e.g. faster components on the motherboard or faster graphics that
reduce cpu overhead).
Hardware differences may not account for the entire performance difference, and there are other
factors (load on the different systems, compilers, the particular kernel being used on Linux) to
consider, but the performance equation is a lot more complicated than it seems, and that factor of
3.4 difference between 5.3 on the two machines is probably a lot due to the hardware.
-John