iamaleksey/seestar — pull request #3 by janchochol (2013-12-06 12:29:44+00:00)
Title: Optimize decode of large responses

Each time Seestar receives part of response body it appends it to binary
accumulator. When response is quite large these appends creates big
performance problem.
Reason is that each append means creating new larger binary and copying
content from previous binary accumulator (which can be quite large).
Complexity of such operation is O(n^2), when 'n' represents size of
data.

New approach append buffers only till point, where size of request will
be found. Since this point all pieces will be stored in iolist, till all
request data will be available. Then iolist will be converted to binary
and processed as previously.
Complexity of this operation is O(n).
In one of our example processing time (including Cassandra response
time) drops from 13 minutes to 30 seconds for 55MB response.