This content has been marked as final. Show 6 replies
you can't possibly make any meaningful deduction about performance from that snippet of code.
looking at this and your previous question ( What is the differce in these bellow for loops )... what exactly are you trying to accomplish?
1005564 wrote:even if there was: what do you think will be an alternative?
that means if too many records, is there any performance issue with for loop
Be careful that you don't spend all your time looking for minor performance gains when your time can be better spent learning higher level concepts.
In most programs, loop performance isn't much of an issue, unless some expensive operation (such as a database query) is inside the loop, and the loop is called many, many times. If everything inside the loop is just done in memory, & doesn't use outside resources, you'll probably be OK.
Of course, there are exceptions to every rule. If you're doing weather modeling or nuclear explosion simulations, then CPU performance can be an issue. But these are advanced applications, & you're obviously at the beginner level. So for now, don't worry about loop performance unless you have proof that that it's causing a problem.
Yes, there is:
But it only exists in your head: it's that notion that you need to have the very tightest possible code instead of plain easily readable source and let the optimizing compiler take it from there. The compiler may not even use your structure that you are trying to optimize, so what's the point?
Once you have your project, then see if there are any bottlenecks, but in reality, you will be hard pressed to find any significant code changes for opimizaton if you just write good, clean, readable, logically correct code.
Is there any performance issue in bellow code ?A meaningless question. It depends entirely on what is inside the loop.
that means if too many records, is there any performance issue with for loopToo many records for what? Another meaningless question.
The loop will execute 2000 times. That is the only thing that can be said about it.