Optimizations for sites with hundreds of SQL queries

I keep getting following error in Firebug (2.0.4) and FirePHP (0.7.4):

> "There was a problem writ...ePHP/FirebugConsole/0.1", SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

This error shows up, when there is more than one chunk of json stream created. I actually do not know how to fix json stream, but I have found, that even payload of size 100kB can be sent in one chunk and Firefox displays it just fine. So I suggest to let user specify the length of the chunk.

Additionally I think, that saving some CPU cycles, by setting constant headers only once may be a good idea. However, compared to the payload being json_encoded for each SQL statement this does not seem like noticable improvement.