best methods to do C,C++ code optimization ?

Discussion in 'C++' started by swathi, May 29, 2007.

  1. swathi

    swathi Guest

    What are the best methods to do C,C++ code optimization manually ?
    I has gone though some links sill not satisfied.
    Can any one send me best optimization links
     
    swathi, May 29, 2007
    #1
    1. Advertising

  2. swathi wrote:
    > What are the best methods to do C,C++ code optimization manually ?
    > I has gone though some links sill not satisfied.
    > Can any one send me best optimization links


    Try "Efficient C++" book. The main thing to understand is that any
    optimizations should be based on measuring and analyzing.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, May 29, 2007
    #2
    1. Advertising

  3. swathi

    Andre Kostur Guest

    swathi <> wrote in news:1180451684.020073.20780
    @g37g2000prf.googlegroups.com:

    > What are the best methods to do C,C++ code optimization manually ?
    > I has gone though some links sill not satisfied.
    > Can any one send me best optimization links
    >
    >


    Measure, measure, measure. Use some sort of profiling tool to find out
    where your code is _actually_ too slow. Then look at why that code would
    be too slow and fix it. Usually by changing algorithms.
     
    Andre Kostur, May 29, 2007
    #3
  4. Andre Kostur wrote:
    > swathi <> wrote in news:1180451684.020073.20780
    > @g37g2000prf.googlegroups.com:
    >
    >> What are the best methods to do C,C++ code optimization manually ?
    >> I has gone though some links sill not satisfied.
    >> Can any one send me best optimization links
    >>
    >>

    >
    > Measure, measure, measure. Use some sort of profiling tool to find
    > out where your code is _actually_ too slow. Then look at why that
    > code would be too slow and fix it. Usually by changing algorithms.


    The usual spiel about what to do after you measure, is "prevent extra
    work from being performed" and "cache everything you can" and "use
    lookup tables everywhere". When none of those are possible (i.e. they
    have all been already applied), rearrange your objects in memory to
    reduce CPU cache misses and page faults. Oh, and one more is "do all
    work when the user is not looking", i.e. in the "background". Good
    luck!

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, May 29, 2007
    #4
  5. Re: best methods to do C,C++ code optimization ?

    On May 29, 11:14 am, swathi <> wrote:
    > What are the best methods to do C,C++ code optimization manually ?
    > I has gone though some links sill not satisfied.
    > Can any one send me best optimization links


    The following article describes C and C++ optimization techniques:

    http://www.eventhelix.com/RealtimeMantra/Basics/OptimizingCAndCPPCode.htm

    --
    EventStudio 4.0 - http://www.EventHelix.com/EventStudio
    Model in Plain Text; Generate Sequence Diagrams in PDF/Word
     
    EventHelix.com, May 30, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pete Wright

    Re: Code optimization...

    Pete Wright, Jul 5, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    394
    David Waz...
    Jul 6, 2003
  2. PWalker
    Replies:
    3
    Views:
    762
    richardv2
    Dec 15, 2004
  3. joshc
    Replies:
    14
    Views:
    800
    Keith Thompson
    Jan 14, 2005
  4. Ravikiran

    Zero Optimization and Sign Optimization???

    Ravikiran, Nov 17, 2008, in forum: C Programming
    Replies:
    22
    Views:
    900
    Thad Smith
    Nov 24, 2008
  5. Kenneth McDonald
    Replies:
    5
    Views:
    355
    Kenneth McDonald
    Sep 26, 2008
Loading...

Share This Page