471,120 Members | 1,322 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,120 software developers and data experts.

Is using a jump statement more faster than using if statement

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
1 1654
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.

Similar topics

2 posts views Thread by Andreas | last post: by
2 posts views Thread by Sandy | last post: by
13 posts views Thread by jkimbler | last post: by
53 posts views Thread by Vicent Giner | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.