[Tutor] Windows vs Linux processing speed.

Steven D'Aprano steve at pearwood.info
Sat Oct 15 00:28:19 CEST 2011


bob gailer wrote:
> On 10/14/2011 12:45 PM, Tony Pelletier wrote:
>> Hi,
>>
>> I have a question regarding the speed of my program on linux in 
>> comparison to windows.
> [snip]
> 
> Speed of a pure Python program depends on
> 
>  * processor speed
>  * competition for resources from other processes
>  * perhaps RAM

"Perhaps" RAM? The amount of memory is close to the easiest, cheapest 
way to speed up a program: more RAM means it is easier and faster to 
allocate memory in the process, which means more time performing *your* 
code and less time hunting for blocks of memory. More RAM means less 
chances you will start using virtual memory, that is, paging blocks of 
memory out of RAM onto the hard drive, which is around a *thousand* 
times slower than RAM. You can never have too much RAM :)

Very few program's speed are greatly dependent on raw processor speed. 
Processor speed is one of the great marketing gimmicks of all time. Of 
course it has *some* effect, but the bottleneck is almost never the CPU, 
and usually the speed of getting data and/or code out of RAM and onto 
the CPU and from their into the core for the instructions to be 
executed. CPU cache faults are really, really expensive, so the bigger 
the pipeline into the core, the fewer the cache faults.

But the most important factor determining the speed of a program is what 
it actually does, and the algorithm it uses to do it.


-- 
Steven


More information about the Tutor mailing list