Comparisons of computation timing
steve+comp.lang.python at pearwood.info
Fri Sep 16 09:19:05 CEST 2011
Akand Islam wrote:
> I have run my codes (written in Python) in my Notebook (3 GB Ram, Dual-
> core CPU T4500 @ 2.3 GHz) and in my lab machine (11.57 GB Ram, i7-920
> CPU @ 2.67 GHz). However, I have found execution time in Notebook
> 250.3 seconds, and in Lab machine 333.2 seconds. How is it possible?
> Good configuration machine performs slower??? I reran the codes, same
> finding whatsoever. I run Windows 7 in my laptop, and Ubuntu 11.04 in
> lab machine. Both are 64 bit. When I ran my simulation in Notebook, I
> also did some other stuffs; however for the case of lab machine I did
> nothing other than running simulation only.
In a modern, multi-processing operating system like Windows, Mac OS or
Linux, you can *never* run only the simulation. There are always other
processes running. Even if you have no other applications running, the
system itself could have dozens or hundreds of processes running in the
background. On one of my Linux systems, a desktop running about four
applications, I have over two hundred processes:
[steve at orac ~]$ ps aux | wc -l
Without knowing more about the two systems, and the code you ran, it is
impossible to say why one is faster than the other. Your question is like
"I drove from home to work with an old Toyota, and it took twenty minutes.
Then the next day, I borrowed my cousin's brand new Ferrari, and the same
journey took thirty minutes. How is this possible?"
On the Ubuntu machine, what does "ulimit -a" report? How does that compare
to the Window machine? Where there any cron jobs running at the time? Did
your Ubuntu system decide that this was a good time to download a whole lot
of system updates? Can you use the "nice" command to run at a higher
priority? Is your code limited by CPU, memory or disk I/O? Which desktop
environment is your Ubuntu system running, Gnome, Unity, KDE, Ratpoison, or
There could be dozens of factors that make a difference to speed.
> About the codes: Basically it simply solves some non-linear equations
> using "fsolve" along with some other calculations.
What is "fsolve"?
> I will appreciate if some one discusses about possible reasons? For
> fair comparisons, in both machines I ran exactly the same codes. My
> codes are not parallelized, is this the main reason i7 processes show
> slower performance?
Don't believe hardware manufacturer's advertising. These days, chip speed is
not so important. Cache misses are MUCH more critical: a slow chip with a
big cache will out-perform a fast chip with a small cache nearly always.
More information about the Python-list