• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Better loop construct for "for" loop?

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
MK
 
Author
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic