sirleech/Webduino — pull request #48 by ribbons (2014-01-16 18:05:08+00:00)
Title: Add buffering for all output to improve performance with many small strings

The project I'm working on at the moment builds a fairly large table a cell at a time, which takes a noticeable amount of time to load in a browser due to the small packets being sent across the network.

I propose to update `WebServer::write(uint8_t)` to write to a buffer instead of sending single characters (or short strings) as small packets. This PR also removes the other signatures of `write` so that the base ones in the `Print` class (which call `write(uint8_t)`) are used instead and simplifies the `writeP`/`printP` definitions to do this too.

This greatly improves the performance of pages which are built from a large number of small strings or values at the expense of a small additional amount of memory (which defaults to 32k but can be adjusted with the use of a new macro called `WEBDUINO_OUTPUT_BUFFER_SIZE`) and also saves 86 bytes of flash in my particular project into the bargain.