Re: For-loop optimization question



On Tue, 31 Jul 2007 09:33:38 -0700, Nino <nino9stars@xxxxxxxxx> wrote,
quoted or indirectly quoted someone who said :

The ultimate question is... How much difference does it really make
(with this example or in general) in the way nested for-loops are
organized and handled in Java?

When in doubt, measure. See http://mindprod.com/jgloss/benchmark.html

The innermost loop body will be executed the same number of times
either way.

Either in your head or with variables try counting how many times the
outer loop executes and how many the inner executes. Sum that for and
approximation to your overhead.

What is more important in such loopings is LOCALITY. Don't hop all
over ram. Try to process linearly. This keeps caches happy and VRAM
swapping down.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.



Relevant Pages

  • Using Java from Javascript
    ... Opera and Netscape browsers allow you to include java methods calls in ... As Javascript has support for objects you can use ... The second link executes windows calculator. ...
    (NT-Bugtraq)
  • Using Java from Javascript
    ... Opera and Netscape browsers allow you to include java methods calls in your ... As Javascript has support for objects you can use objects returned by ... The second link executes windows calculator. ... localhost when the script is ...
    (Bugtraq)
  • Java and Javascript
    ... Opera and Netscape browsers allow you to include java methods calls in your ... As Javascript has support for objects you can use objects returned by ... The second link executes windows calculator. ... Both browsers donīt allow to make java calls to determinate methods. ...
    (Bugtraq)
  • Re: why kernel in C
    ... that is the system that executes as main. ... they may only have a handful of bytes of read/write memory. ... >> Java is that basic features of the language require a sizable set ... > semantics of Java. ...
    (comp.os.linux.development.system)
  • Re: Preventing the JVM from shutting down
    ... JVM hangs. ... JNI and then executes a java program. ... During the shutdown sequence on the C++ side, ...
    (comp.lang.java.programmer)