views:

312

answers:

5

Is Python generally slower on Windows vs. a *nix machine? Python seems to blaze on my Mac OS X machine whereas it seems to run slower on my Window's Vista machine. The machines are similar in processing power and the vista machine has 1GBs more memory.

I particularly notice this in Mercurial but I figure this may simply be how Mercurial is packaged on windows.

+1  A: 

No real numbers here but it certainly feels like the start up time is slower on Windows platforms. I regularly switch between Ubuntu at home and Windows 7 at work and it's an order of magnitude faster starting up on Ubuntu, despite my work machine being at least 4x the speed.

As for runtime performance, it feels about the same for "quiet" applications. If there are any GUI operations using Tk on Windows, they are definitely slower. Any console applications on windows are slower, but this is most likely due to the Windows cmd rendering being slow more than python running slowly.

Chris Smith
A: 

Maybe the python has more depend on a lot of files open (import different modules).

Windows doesn't handle file open as efficiently as Linux.

Or maybe Linux probably have more utilities depend on python and python scripts/modules are more likely to be buffered in the system cache.

tony-p-lee
A: 

I run Python locally on Windows XP and 7 as well as OSX on my Macbook. I've seen no noticable performance differences in the command line interpreter, wx widget apps run the same, and Django apps also perform virtually identically.

One thing I noticed at work was that the Kaspersky virus scanner tended to slow the python interpreter WAY down. It would take 3-5 seconds for the python prompt to properly appear and 7-10 seconds for Django's test server to fully load. Properly disabling its active scanning brought the start up times back to 0 seconds.

Soviut
You are probably on to something with the Virus scanner. I have a scanner on my windows machines but not on my OS X machine. I didn't think of that before.
Frank V
The new Microsoft Security Essentials (MSE) scanner is far less aggressive than Kaspersky and Norton can be. I've had no problems running it while working with Python (or any compiler, for that matter).
Soviut
A: 

With the OS and network libraries, I can confirm slower performance on Windows, at least for versions =< 2.6.

I wrote a CLI podcast-fetcher script which ran great on Ubuntu, but then wouldn't download anything faster than about 80 kB/s (where ~1.6 MB/s is my usual max) on either XP or 7.

I could partially correct this by tweaking the buffer size for download streams, but there was definitely a major bottleneck on Windows, either over the network or IO, that simply wasn't a problem on Linux.

Based on this, it seems that system and OS-interfacing tasks are better optimized for *nixes than they are for Windows.

daniel
A: 

I wanted to follow up on this and I found something that I believe is 'my answer'. It appears that Windows (vista, which is what I notice this on) is not as fast in handling files. This was mentioned by tony-p-lee.

I found this comparisons of Ubuntu vs Vista vs Win7. Their results are interesting and like they say, you need to take the results with a grain of salt. But I think the results lead me to the cause. Python, which I feel was indirectly tested, is about equivalent if not a tad-bit faster on Windows.. See the section "Richards benchmark".

Here is their graph for file transfers:

Graph - small file HD to HD

I think this specifically help address the question because Hg is really just a series of file reads, copies and overall handling. Its likely this is causing the delay.

http://www.tuxradar.com/content/benchmarked-ubuntu-vs-vista-vs-windows-7

Frank V