Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[C] Which is faster?

Name: Anonymous 2010-07-13 5:57


if(a > 3)
{
  int expected_b = fun(a);
  if(good_enough(b, expected_b))
  {
    do_stuff();
  }
}


VS


int expected_b = fun(a);
if(a > 3 && good_enough(b, expected_b))
{
  do_stuff();
}


This is done a shitload of times. fun(a) is a simple linear function.

Name: Anonymous 2010-07-13 7:37

depends on [k]a[/k]nus

Name: Anonymous 2010-07-13 7:45

depends on [size=32]anus[/size]

Name: Anonymous 2010-07-13 8:25

well here are my results

[table]
[tr][th][/th][th]code1[/th][th]code2[/th][/tr]
[tr][th]1st pass[/th][th]0.3583[/th][th]0.3522[/th][/tr]
[tr][th]2nd pass[/th][th]0.3533[/th][th]0.3542[/th][/tr]
[tr][th]3rd pass[/th][th]0.3535[/th][th]0.3525[/th][/tr]
[/table]

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List