|
From: | Chen Shizhong-FCHN289 |
Subject: | 6 times slower on Linux than xp |
Date: | Mon, 13 Jun 2011 16:59:12 +0800 |
Hi,
<<main.cpp>> <<R_Exception.hpp>>
When run above code on linux (Ubuntu 10.04, g++4.4.3), the output is:
~/PerfExcept$ date; ./a.out 100000000 20; date
Mon Jun 13 13:31:45 CST 2011
LOOP=100000000, ERR_RATE=0.2
totalTraditionErr=20001530, time=3430000, /time=5.83135
totalIntException=19997909, time=86630000, /time=0.230843
totalObjException=20002016, time=88600000, /time=0.225756
Mon Jun 13 13:34:44 CST 2011
So costs 179sec.
When run it on XP (same PC, g++4.4.1), the output is:
C:\>perfexcept 100000000 20
LOOP=100000000, ERR_RATE=0.2
totalTraditionErr=20003550, time=2593, /time=7714.44
totalIntException=19998567, time=13531, /time=1477.98
totalObjException=20005020, time=13235, /time=1511.52
And it only costs 29sec.
The cpu is Pentium dual-core address@hidden
I doubt the big performance gap is from the compiler. Is it a bug of Linux G++?
Thanks if you can help,
Chen
(1 more thing, I noticed above code occupied 2 cores on xp - each cost ~50%, but linux focus on 1 core & achieve 100% utilization on that core…)
main.cpp
Description: main.cpp
R_Exception.hpp
Description: R_Exception.hpp
[Prev in Thread] | Current Thread | [Next in Thread] |