From: Andrew Haley <aph@redhat.com>
To: "Shane R" <crazguy22@hotmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Linux c++ opmization--- linux runs at half the speed of windows?
Date: Thu, 08 Mar 2007 15:01:00 -0000 [thread overview]
Message-ID: <17904.492.460648.266863@zebedee.pink> (raw)
In-Reply-To: <BAY21-F250BABA055D5D844068C13AE790@phx.gbl>
Shane R writes:
> I hope this is the appropriate forum. Please direct me to the correct one if
> it is not.
>
> I am trying to optimize a c++ application that I ported from a windows
> system to Linux.
OK.
> The app is a terminal based application that does some one time file io at
> the start then runs completely in memory. After the one time io the app runs
> successive timed epochs on the same data in Windows as Linux. The app is a
> program that runs some code for doing non-linear optmization (math stuff).
>
> The reason why I am posting is that I timed the time it takes for the
> application to complete an epoch. It take twice as long in Linux as
> windows?!?!
That is fairly unusual.
> My system is an Intel Centrino Duo with 2gigs of ram. The application is
> only using a fraction of available memory in windows and linux. The
> application is single-threaded in both.
>
> I am using Visual Studio 2003 in Windows and when I type gcc -v I get:
> Target: i486-linux-gnu
> Configured with: ../src/configure -v
> --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
> --enable-shared --with-system-zlib --libexecdir=/usr/lib
> --without-included-gettext --enable-threads=posix --enable-nls
> --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-mpfr --enable-checking=release
> i486-linux-gnu
> Thread model: posix
> gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
>
>
>
> I am currently using these g++ options:
>
> CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall
> -Wno-return-type
>
> But I have tried every permutation of the above options to virtually no
> effect
>
> The average run time of an epoch in windows is about 3000 milliseconds while
> the average run time of an epoch in Linux is 6000!
>
> I don't know if it matters but I am doing calls to the rand() function in
> both my windows and linux apps.
It might matter, yes.
I suspect that the right approach is to do some profiling. Make sure
oprofile is installed, then
sudo opcontrol --init
sudo opcontrol --start
<do your thing>
sudo opcontrol --stop
opreport -l
Let us know how you get along. You might be surprised where the time
goes.
Andrew.
next prev parent reply other threads:[~2007-03-08 12:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-08 12:30 Shane R
2007-03-08 15:01 ` Andrew Haley [this message]
2007-03-08 16:10 ` Atwood, Robert C
2007-03-08 17:10 ` Sven Eschenberg
2007-03-12 22:06 ` Lawrence Crowl
2007-03-12 23:13 ` Artūras Moskvinas
2007-03-13 8:57 ` Galloth
2007-03-12 23:49 ` John Carter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17904.492.460648.266863@zebedee.pink \
--to=aph@redhat.com \
--cc=crazguy22@hotmail.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).