Re: Why so FASTS on Windows? (was: Why so slow on Windows?)
| From: | Umberto Salsi | Date: | Tue, 11 Feb 2014 07:04:39 +0000 |
| Subject: | Re: Why so FASTS on Windows? (was: Why so slow on Windows?) | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322814@lists.php.net to get a copy of this message | ||
On 2014-02-10 21:38, Robert Williams wrote:
> Your best first step is to profile the code. I suspect there’s a particular function call
> that’s responsible for most of the slow-down. For example, maybe your fopen() calls are triggering
> a network hit by the OS. Once you know the exact source of the slow performance, you can figure out
> what to do about it.
Ok, I'm a sucker. The word "fopen" put me in the right direction: it had
to be a difference related to the file system: Windows is
case-insensitive, and my program takes care of this comparing files and
paths in case-insensitive way. But here it was the bug: wrong hash
calculation of case-insensitive Unicode strings bringing to the same
exact value for each string, in turn bringing to hash table collisions,
in turn forcing a repeated case-insensitive comparison between file names.
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
3) Windows Vista Business, Pentium E5300, 32 bits 2.6 GHz,
(same PC of point 2 above)
PHP-CLI 5.5.9-nts:
3.31 s * 2.6 GHz = 8.6 Gcycles
Then the question now is: why so slow on Linux?
I already said I'm a sucker?
Thank you very much to everybody and sorry for the disturb.
--
Regards,
___
/_|_\ Umberto Salsi
\/_\/ www.icosaedro.it