A quick lesson in performance tuning. In the arduino code base, people will often use Serial.parseInt to read integer data from a Serial stream, and someone was asking me about the overhead involved. So, I decided to take a look for them. First, I looked at the implementation of parseInt:
long Stream::parseInt()
{
return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout)
}
Ok, so it calls through to another function, adding a skip character that means "no skip character". Here's a first red flag. So, let's look at that function: