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.