From: Sadanand on
hi all,
Can anybody please let me know how compiler optimize a C++ code? can
you give me a simple example? which will help me to write more
optimized code in all my working projects.

Thanks & Regards,
Sadanand

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Francis Glassborow on
Sadanand wrote:
> hi all,
> Can anybody please let me know how compiler optimize a C++ code? can
> you give me a simple example? which will help me to write more
> optimized code in all my working projects.


Stop worrying about it. The chance that you can write code in such a way
that a compiler will optimise it better is too small to concern
yourself. Just write good readable code. Now if the performance is
inadequate profile it to find the bottlenecks and then address those. In
fact most of the time it is a matter of finding a better algorithm.

Modern compilers can do quite extraordinary things when they optimise a
program (and that depends on whether you want a small program or a fast
one.)

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: ramblex on
On Dec 19, 12:34 am, Sadanand <steggi...(a)gmail.com> wrote:
> hi all,
> Can anybody please let me know how compiler optimize a C++ code? can
> you give me a simple example? which will help me to write more
> optimized code in all my working projects.

{ edits: quoted sig and banner removed. please don't quote the banner. -mod }

You'd probably be better off searching for this sort of thing on
google. For example from 'C++ optimisation', the first result is
http://www.tantalon.com/pete/cppopt/main.htm seems to be roughly what
you're looking for. It also depends on which compiler you use as to
how your code is optimised exactly...


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Mathias Gaunard on
On 19 d�c, 14:45, ramblex <alexdul...(a)googlemail.com> wrote:

> You'd probably be better off searching for this sort of thing on
> google. For example from 'C++ optimisation', the first result is http://www.tantalon.com/pete/cppopt/main.htm seems to be roughly what
> you're looking for.

This particular website looks more a list of bad ideas (two-phase
initialization, limit exception handling, disable RTTI) than
optimization techniques though.

So I think people are not better off searching stuff on Google instead
of asking in a group where quite a few experts go.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Bo Persson on
Mathias Gaunard wrote:
> On 19 d�c, 14:45, ramblex <alexdul...(a)googlemail.com> wrote:
>
>> You'd probably be better off searching for this sort of thing on
>> google. For example from 'C++ optimisation', the first result is
>> http://www.tantalon.com/pete/cppopt/main.htm seems to be roughly
>> what you're looking for.
>
> This particular website looks more a list of bad ideas (two-phase
> initialization, limit exception handling, disable RTTI) than
> optimization techniques though.
>

It starts by saying that the results are valid for VC++ 6.0 running
Windows 95 on a Pentium II.

If you happen to have another configuration :-), you may have to run
the tests again to get the results for your platform. They would
probably be quite different.


Bo Persson



--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

 |  Next  |  Last
Pages: 1 2
Prev: extern versus #include
Next: comparing iterators