Closed AeroNotix closed 10 years ago
generate-stream
returns a BufferedWriter, not an InputStream. This patch won't work with Ring.
Is there any point in pursuing this? Will webservers be able to take advantage of streams?
It depends on what Cheshire and Jackson are doing being the scenes. If they're loading the data structure into memory before writing it, then there would be less benefit to using streams.
In order for this to work, you'd need to pipe the output of the writer to a new inputstream. This might take more time than simply returning a string, especially JSON under 4096 bytes, or whatever the default buffer size is.
Really, the one way to be certain is to benchmark it and see what works, but I suspect that this would actually be less performant for the majority of JSON responses, which tend to be only several kilobytes in size.
Closing, then.
Correct me where I am wrong but I was under the impression that using streams instead of strings allows the webserver to stream the response to the client more easily.