help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: g++ and library optimisations


From: Paul Pluzhnikov
Subject: Re: g++ and library optimisations
Date: Sun, 13 May 2007 09:34:02 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"pemo" <usenetmeister@gmail.com> writes:

> Where is the STL source normally located - can find the vector.h but not the 
> cpp?

You aren't looking for either vector.h or vector.cpp.

You are looking for 'vector' (and, as I already explained, there
*isn't* a .cpp file, because STL is all templates, which are *not*
compiled into a library).

Assuming gcc 4.1.1 in default RH installation, the 'vector' would
be found in:

$ rpm -ql libstdc++-devel | grep 'vector$'
/usr/include/c++/4.1.1/debug/vector     # this is internal debug version
/usr/include/c++/4.1.1/vector           # this is what client code uses.

>> Sure: just add '-Wl,-verbose' and it will spit lines like this:
>
> Her g++ [4.1.1 20070105 (Red Hat 4.1.1-51)] didn't understand either of 
> those switches - not did gcc [should one use gcc rather than g++?]

There are no "those switches". It's a *single* switch, spelled
*exactly* this way:

   g++ ... -Wl,-verbose 

All versions of gcc (and g++) since at least 2.7.2 (which is over
10 years old) do understand this switch. Most definitely g++-4.1.1
does.

>> Note that correct profiling is a bit of "black art", best performed

> -pg seemed to work, but nothing seemed to be generated. running gprof, it 
> couldn't find gmon sometimes, or a.out when the app was compiled via gcc.

You seem to be lacking the necessary skills to help her with
profiling. As I said, it may require a bit of wizardry.

Given that you didn't supply any details, other than "nothing seemed
to be generated", it's hard to tell what may have gone wrong.

Suggestion: compile a simple application (main with a couple of
functions with time-consuming loops) with '-pg'. Run it to learn
how gprof works, what output to expect, etc. Only then try the real
application.

>> Lastly, if she is on Linux/x86 or Linux/x86_64, she might get some
>> significant speedup with Intel 'icc' (or not).
>
> No icc installed it seems.

It wouldn't be (unless someone else bought a license and installed
it): it's not free software. You buy it from Intel (after trying
a free demo version to see if there is any benefit to be gained).

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]