Any one have a real world example where benchmarks show a big win?
The average data rate has to be lower than the serial data rate, and the size of data output "per call" has to be lower the the space available in the output buffer.
For example, a 64 byte buffer is a win if I send a 32byte message with a status update of my computations, once every second, at 19200bps. With buffering, the computations will run essentially continuously. Without, they'll be stalled waiting for the serial port. Of course, under those circumstances, you're not spending a lot of time doing output anyway...
The following sketch is an example. It runs about 250ms faster (out of about 20 seconds) in 1.0 than in 0022 (which is a bit odd, since I figure it ought to be running closer to 600ms faster (~30ms for each of ~20 lines printed.) I wonder what's going on?)
unsigned long counter;
void setup()
{
Serial.begin(9600);
counter = 0;
}
void loop() {
counter++;
if ((millis() % 1000) == 0) {
Serial.print("Counter reached ");
Serial.print(counter);
Serial.print(" in time ");
Serial.println(millis());
}
if (counter >= 500000) {
Serial.print("\nCounter Completed at ");
Serial.print(counter);
Serial.print(" in time ");
Serial.println(millis());
while (1) ; //stop
}
}