loop() apparently is not really a loop...

I just stuck a continue statement inside the loop() function and the compiler complained that I had a continue outside a loop. So, apparently the loop is not really a loop. What's the accepted method of doing this? I suppose I could put an endless while loop inside loop(), but that seems, well, strange...

It's not a loop. It's just called "loop".

It loops in the sense that "main" (which is added in by the IDE) calls loop repetitively. Like this:

while (true)
  loop ();

If you want to leave loop (and then have it re-entered immediately) just do a "return".

Example:

void loop()
{
  byte key = kpd.getKey();

  if (key == 0)
     return;    // no key pressed, don't keep processing this time around

  switch (key)
    {
      case 'a': // do something
         break;
      case 'b': // do something
         break;
    } // end of switch
}  // end of loop

Ah, so return, okay...

But, I went and added an endless while loop inside my loop() function and I was rewarded with a signifigant increase in performance. I had a delay at the top of the loop method to keep it iterating about once a second. I just had to substantially increase that delay. Apparently calling loop() entails a lot of overhead somewhere.

I can’t agree with that. And here is the proof. First sketch, uses loop to iterate:

void setup ()
{
  pinMode (13, OUTPUT);
}

void loop ()
{
  digitalWrite (13, HIGH);
  digitalWrite (13, LOW);
}

Timing with a logic analyzer (first attachment) shows that it takes 14.375 microseconds from one “high” to the next. So we are around the loop in 14.375 microseconds.

Second example, does “an endless while loop inside my loop() function” …

void setup ()
{
  pinMode (13, OUTPUT);
}

void loop ()
{
  while (true)
  {
  digitalWrite (13, HIGH);
  digitalWrite (13, LOW);
  }
  
}

Now it takes 13.75 microseconds. That is only 0.625 microseconds faster. I would expect it to be slightly faster because we don’t have the overhead of the function call. But that is only 625 nanoseconds!

I wouldn’t call that “a lot of overhead”.

I had a delay at the top of the loop method to keep it iterating about once a second.

Your delay is doing it, not the way loop is called.

I just had to substantially increase that delay.

Even if you increased “delay” from delay(1) to delay(2) that is 1 millisecond, which is 1000 microseconds. And the extra overhead was less than 1 microsecond.

Loop_example_1.png

Loop_example_2.png

That's strange... I doubt it makes a difference but I'm using a Sanguino. I'll do some tests here to see what happened, although I don't have a logic analyzer.