Re: forall and do loop



On Jul 27, 9:09 am, aeroguy <sukhbinder.si...@xxxxxxxxx> wrote:
Thanks guys. Ok so i don't want to manually modify my code for any
optimization?

No, you just don't want to tune your code for _every_ optimization.
Usually more than 90% time is spent in less than 10% code, that's
where you should can consider manual optimizations. An "auto-
optimizing coding style" usually does more damage than good.

Of course, you need to find the bottlenecks. They are usually located
in nested loops (or array expressions within loops) - look for those.
If you learn how to use a profiler, your chances will vastly increase.
Try isolating the bottlenecks into separate subroutines - that can
simplify optimizations by driving out aliasing issues. (the golden
aliasing rule of Fortran)


But then there are these two ways to do so...which one
should be followed. Both are correct ? right? Then how should i
determine which one i should use.... why i should give the first
preference or the latter one?

Use the one that appears more clear to you - easier to read and/or
write.

.



Relevant Pages

  • Re: Optimization (was Re: C portability is a myth)
    ... your compiler is converting your code into inefficient instructions, ... > optimization (which I wrote about prior to the existence of the Athlon ... that ordering instructions in certain ways will always lead to faster ... Until you know where the bottlenecks are, ...
    (comp.lang.c)
  • Re: Many threads in Linux
    ... about while I'm analyzing my current system is Hoare's dictum: ... "premature optimization is the root of all evil". ... reliable way I know to find out your bottlenecks is to measure the ... the most straightforward way to provide client access to this data ...
    (comp.programming.threads)
  • Re: A question about efficiency
    ... IMHO this is a case of "premature optimization". ... You need to profile your application first to find out where the bottlenecks ...
    (microsoft.public.vc.language)