Re: What's more important optimisations or debugging?



Dave Hansen wrote:
On May 30, 5:15 pm, rhapg...@xxxxxxxxx wrote:
I'm trying to get a feel for what people now consider more important,
optimisations or debugging ability. In the past with such tight memory
limits I would have said optimisations but now with expanded-memory
parts becoming cheaper I would think that debugging ability is more
important in a development tool. It's is not exactly a black and
white question, debug or smallused, but more a ratio. eg. 50% debug/
50% optimised or 70% debug/30% optimised, etc.

The rule is "Make it right, _then_ make it fast." Fast enough is fast
enough. If the optimizer makes your code undebuggable, and you need
the debugger, don't use the optimizer.


Remember Knuth's golden rules about optimisation:

1. Don't do it.
2. (For experts only) Don't do it yet.

That applies to hand-tuning of the source code, rather than automatic optimisations in a compiler, but it's important to remember that the speed of the code is irrelevant if it does not work.

That said, I generally set my compiler to optimize for space. It
hasn't really caused me any debugging troubles in at least 5 or 10
years. Of course, most of my debug activity resembles inserting
printf statements rather than stepping through code in an emulator.
YMMV.


In my experience, it is often much easier to debug code when you have at least some optimising enabled on the compiler. Code generated with all optimisations off is often hard to read (for example, local variables may end up on a stack, while register-based variables can be easier to understand).

mvh.,

David

Regards,

-=Dave


.



Relevant Pages

  • Re: Whats more important optimisations or debugging?
    ... optimisations or debugging ability. ... limits I would have said optimisations but now with expanded-memory ... important in a development tool. ... white question, debug or smallused, but more a ratio. ...
    (comp.arch.embedded)
  • Re: Whats more important optimisations or debugging?
    ... optimisations or debugging ability. ... limits I would have said optimisations but now with expanded-memory ... white question, debug or smallused, but more a ratio. ...
    (comp.arch.embedded)
  • Re: Whats more important optimisations or debugging?
    ... optimisations or debugging ability. ... In the past with such tight memory ... limits I would have said optimisations but now with expanded-memory ... What is VERY worrying is that you were prepared to sacrifice quality to use a smaller part. ...
    (comp.arch.embedded)
  • Re: Whats more important optimisations or debugging?
    ... optimisations or debugging ability. ... limits I would have said optimisations but now with expanded-memory ... parts becoming cheaper I would think that debugging ability is more ... I also appreciate the ability to use Standard C as much as possible, rather than resort to needless proprietary mechanisms. ...
    (comp.arch.embedded)
  • Re: Whats more important optimisations or debugging?
    ... optimisations or debugging ability. ... limits I would have said optimisations but now with expanded-memory ... The fact that parts with more memory are getting cheaper is irrelevant. ...
    (comp.arch.embedded)