Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Code that is organized so that it minimizes context switches is ofen faster and more efficient than code that doesn't.

E.g. sometimes this code:

  foreach (x in xs)
      F(x);

   foreach (x in xs)
      G(x);

   foreach (x in xs)
      H(x);
is faster/more efficient than this:

   foreach (x in xs)
   {
        F(x);
        G(x);
        H(x);
   }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: