|
-
February 27th, 2009, 04:11 AM
#1
which loop is faster?
Hi, i had this idea that one loop might be faster than another, in terms of binary operations or w/e, but im not sure so i will ask. Suppose you have high performance code and you want the best loop. The loops are doing the same thing but my thought was that there underlying structures that operate the loops, one must be more efficient. I dont have the tools to test the speed and memory/bit usage of these, i was looking for more of a theoretical explanation of which would be faster. Two Examples.
Code:
//While loop
int i=0;
while(i<1000000)
{
i++;
}
//For loop
for(int i=0;i<1000000;i++){/**/}
//I did not compile this
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|