Re: forall and do loop



On Jul 27, 7:56 am, aeroguy <sukhbinder.si...@xxxxxxxxx> wrote:
thanks for the reply. My main concern in this program test is not
about low level compiler but to know which coding practise is
effecient in a general sense. I mean, which code will be better
optimized by the compiler if i choose to use the compiler optimization
option.

Yes, that's exactly what Sebastian tried to warn you about.
I second to that: do _not_ try to adjust your coding practices
to compiler optimizations. These change if you switch compiler,
and they also change as time goes by (improve, hopefully :).
Do not regard the "programming for speed" (or similar, this one is
from Intel's) section of manual as recommended coding practices,
but rather like a cookbook what to try if you want to deal with a
bottleneck.

For instance, 10 years back (I'm guessing) it was not wise
to do
y = matmul(transpose(A),x)
because a temporary was created for transpose.
Today, most compilers do TRANSPOSE in-place by descriptor
manipulation, and some also optimize MATMUL so that it detects a
TRANSPOSEd argument and uses optimized code for that case.

.



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)