Current time: 12-15-2017, 03:01 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ Optimization Techniques
12-04-2009, 04:28 PM
Post: #1
C++ Optimization Techniques
Is there a site that provides a great list of common C++ optimization practices? What I mean by optimization is that you have to modify the source code to be able to run a program faster, not changing the compiler settings.



I don't have a site off the top of my head but the book "Exceptional C++" by Sutter is superb for C/C++ development.

I highly recommend every C++ programmer read this book as it gives great insight in to not only optimization but smart usage of the language so that you will program truly exceptional.



Two ways to write better programs: Make best use of language Code Complete by Steve McConnell Effective C++ Exceptional C++ profile your application Identify what areas of code are taking how much time See if you can use better data structures/ algorithms to make things faster There is not much language specific optimization one can do - it is limited to using language constructs (learn from #1).

The main benefit comes from #2 above.



The best optimization one can get is by revisiting the design, and after profiling the performance relevant parts/algorithms of the application.

This is usually not language specific. What I mean is (just as an idea) if you would get 30% performance improvement by selecting a slightly better algorithm (or collection/container class) the improvement you can expect from a C++ related refactoring would be at most 2%.

A design improvement could give you anything above 30%. If you have a concrete application, the best strategy is to measure and profile the application.

Profiling gives usually the most instant idea of which parts are performance relevant.
Find all posts by this user
Quote this message in a reply
12-14-2009, 09:04 AM
Post: #2
RE: C++ Optimization Techniques
This is kind of beyond the scope of this website. C++ doesn't play into web development that often (unless you're writing PHP modules etc)
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)