What is a "tight loop"?

Frederick The Fool picture Frederick The Fool · Feb 6, 2010 · Viewed 22.1k times · Source

I've heard that phrase a lot. What does it mean?

An example would help.

Answer

kennytm picture kennytm · Feb 6, 2010

From Wiktionary:

  1. (computing) In assembly languages, a loop which contains few instructions and iterates many times.
  2. (computing) Such a loop which heavily uses I/O or processing resources, failing to adequately share them with other programs running in the operating system.

For case 1 it is probably like

for (unsigned int i = 0; i < 0xffffffff; ++ i) {}