datastax/nodejs-driver — pull request #3 by gwicke (2014-09-19 19:23:44+00:00)
Title: Performance: Avoid excessive buffer copying on large values

Rows with large (>64k) values would be accumulated by repeatedly concatenating
a new chunk with the entire buffered value received so far. In benchmarks with
a 3mb value and a REST front-end this led to buffer copying being responsible
for about 56% of all CPU time.

This patch avoids this issue by recording how many bytes are expected for the
next cell, and then accumulating all buffers in an array until enough bytes
are received. The buffers in the array are only concatenated once, which
avoids the quadratic copying seen before this patch.

This is a rebase of https://github.com/jorgebay/node-cassandra-cql/pull/103 to
the new repository.