Re: For-loop optimization question
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jul 2007 19:56:31 GMT
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
.
- References:
- For-loop optimization question
- From: Nino
- For-loop optimization question
- Prev by Date: Re: Generate serialVersionUID in Eclipse for serializable object
- Next by Date: Re: tomcat log4j
- Previous by thread: Re: For-loop optimization question
- Next by thread: Custom JPanels inside another JPanel.
- Index(es):
Relevant Pages
|
|