Is using a jump statement more faster than using if statement

  • Thread starter Thread starter lianqtlit
  • Start date Start date
L

lianqtlit

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 == null)
{
continue;
}
a =10;

}

or

no jump statement
example

for(int i=0; i < 10; i++)
{
if(a !=null)
{
a =10;
}
}
 
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).
 
Back
Top