Optimization settings

This is a discussion on Optimization settings within the C Programming forums, part of the General Programming Boards category; We are using Paradigm C compiler to build embedded C application under small memory model and for 186 processor. Paradigm ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    175

    Optimization settings

    We are using Paradigm C compiler to build embedded C application under small memory model and for 186 processor. Paradigm offers set of optmizations bits. like optimization by speed, by size, loop optimization, jump optimization etc.

    In such scenario, what is advatage with boosting the optimization and what is disadvantage?

    Please let me know,

    Thanks,

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    Advantage: compiling for size may mean the code fits in the memory allowed
    Disadvantage: it now runs too slow to meet its performance requirements.

    There are no free lunches, and no easy way to decide which is best for you. You need to try each one and evaluate the impact in your particular case.

    Another disadvantage (perhaps) is that aggressive optimisation often flushes out bugs which would otherwise remain hidden.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    175
    I was under impression that compilers which do maximum optimization are the good compilers.

    But if this is the case, how do we classify a good compiler?

    Thanx

  4. #4
    .
    Join Date
    Nov 2003
    Posts
    307
    Maximum optimization by a compiler means it has to depend on compiling perfect code source code. Otherwise it's assumptions could cause problems. It has nothing to do with good/bad compilers.

    Generally, optimization makes the machine code larger. You don't have memory. You need to depend on good algorithms instead of the compiler.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    > compilers which do maximum optimization are the good compilers.
    "maximum" and "good" are both subjective and relative.

    Take any specific block of code and pass it through a number of different compilers with a variety of optimisation settings, and you'll get a whole bunch of different answers. How do you decide which has "maximum" optimisation?

    For a start, are you trying to maximise speed or minimise space?

    > how do we classify a good compiler?
    One which translates valid C programs correctly.

    In particular, "aggressive optimisation often flushes out bugs" is still more likely to be your problem than a problem with the compiler. That's not to say that compilers don't have bugs (they do), but if a compiler does have a bug, it's more likely to be in some small corner of some particular optimisation option than in the core translation.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Application fails to load settings only at windows startup
    By DanFraser in forum C# Programming
    Replies: 3
    Last Post: 09-27-2009, 11:15 AM
  2. sorting the matrix question..
    By transgalactic2 in forum C Programming
    Replies: 47
    Last Post: 12-22-2008, 02:17 PM
  3. (Visual C++) MFC Tree Control to do a settings page
    By guitarist809 in forum Windows Programming
    Replies: 6
    Last Post: 08-30-2008, 11:31 PM
  4. need reading material for c++ database optimization
    By elninio in forum C++ Programming
    Replies: 0
    Last Post: 07-24-2008, 11:32 PM
  5. Citrix regional settings
    By nvoigt in forum Tech Board
    Replies: 0
    Last Post: 10-26-2005, 07:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21