I've been thinking a lot about why the Buffer-based TCP transports have so little performance gain on the top-end (and why they both have *less* throughput than the HTTP transport for large messages where it should be roughly equal performance) and I think this is why.

``this.buffer = this.buffer.concat(data)`` is *exactly the same* as ``this.buffer += data.toString()`` in terms of memory allocation and memory writes: one chunk of data in memory and another chunk of data in memory are copied to a new chunk of memory with a length equal to the lengths of the original chunks of memory, and then the old chunks are put on the GC to be eliminated.

The way to get the perf boost we want is to allocate a "reasonable" sized buffer and copy new chunks of data in (just one write, no new data allocations), keeping track of the beginning and end of the used buffer space, and when we are near the end of the allocated buffer space make a decision on whether or not we want to rescale the buffer or simply move the data to the beginning of the buffer (that would depend on whether or not the data placed at the beginning of the buffer would overlap the data where it currently stands) and if so, allocate a new buffer double the size of the current and copy the used buffer space to the beginning of the buffer.