By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,581 Members | 2,007 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,581 IT Pros & Developers. It's quick & easy.

Is using a jump statement more faster than using if statement

P: n/a
Is using a jump statement more faster than using if statement

with a jump statement
example

for(int i=0; i < 10; i++)
{

if(a[i] == null)
{
continue;
}
a[i] =10;

}

or

no jump statement
example

for(int i=0; i < 10; i++)
{
if(a[i] !=null)
{
a[i] =10;
}
}
Feb 6 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
It's probably the same, as the IL will produce a jump statement of some
kind to move to the next iteration of the loop, which is the same thing the
continue is going to do.

It really shouldn't matter, unless you are doing this so many times and
you have identified this loop as being a bottleneck (while at the same time
identifying that the operations that are actually getting performed in the
loop are ^not^ bottlenecks).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"lianqtlit" <li*******@discussions.microsoft.comwrote in message
news:30**********************************@microsof t.com...
Is using a jump statement more faster than using if statement

with a jump statement
example

for(int i=0; i < 10; i++)
{

if(a[i] == null)
{
continue;
}
a[i] =10;

}

or

no jump statement
example

for(int i=0; i < 10; i++)
{
if(a[i] !=null)
{
a[i] =10;
}
}
Feb 6 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.