Compiler optimization

From: AMH (ingen_at_spam.tak)
Date: 12/15/04


Date: Wed, 15 Dec 2004 22:15:19 +0100

I'm interested in how the compiler optimizes. In the code below, is (1)
optimized to (2) when the code is compiled or does it calcuate Size div
10 - 1 each iteration? Furthermore - where can I read more about
compiler optimization?

1)

for Iterator := 0 to Size div 10 - 1 do

2)

Size := Size div 10;

for Iteratopr := 0 to Size - 1 do



Relevant Pages

  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... what experienced programmers do, ... optimization, ... Thugs" ad nauseum fits that a lot more closely than discussing compiler ... be modified outside a loop, and guessing ...
    (comp.programming)
  • long(!) Re: need help on CFLAGS in /etc/make.conf please
    ... For example, MPlayer sets this high on purpose, so GCC will actually ... and the K&R compiler would've known exactly the kind of optimization we wanted. ... >> A msg from Richard Coleman, taken together with the GCC 3.x Known Bugs ...
    (freebsd-questions)
  • Re: SETF and variable issues in Self Similar program.
    ... The way to get a compiler to optimize a tail-call ... call optimization turned on. ... It changes the semantics of the language in a big way. ... In Common Lisp it has to interact with condition handling, ...
    (comp.lang.lisp)
  • Re: Programming languages
    ... >> execution time, ... That's not a good candidate for optimization. ... if there is comething the compiler ... António> programmers and those can't cope with anything else than ...
    (sci.lang)
  • Re: Debugging and optimizations
    ... and compiler optimizations. ... Earlier in the week I was talking to a developer about optimization ... The problem is in the compiler not the source level debugging format. ... The compilers should be able to provide source level debug information ...
    (comp.programming)