permaculture playing cards
The moose likes Performance and the fly likes Better loop construct for Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Better loop construct for "for" loop?" Watch "Better loop construct for "for" loop?" New topic

Better loop construct for "for" loop?

Thillai Sakthi
Ranch Hand

Joined: Jun 17, 2000
Posts: 102
Last week I took Brainbench test. There there are couple of questions on code optimization. In place of "for" loop what loop construct can we use? Actually I am new to the are of performance tuning. Can any one help me with some basic ideas or thumb rules which I can follow in my day-today programming?
Thanks in advance

Jack Shirazi
Ranch Hand

Joined: Oct 26, 2000
Posts: 96
In place of the for loop, you can use 'while', but this is not a performance issue. All loops are functionally identical and can be converted between themselves.
In terms of basic rules-of-thumb for programming from the view of performance, you should code without really considering performance. Performance should be considered at the analysis/design stages, and <em>after</em> the implementation has become functional. Then the application should be profiled to find the bottlenecks, and those bottlenecks removed.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Better loop construct for "for" loop?
It's not a secret anymore!