postwait/node-amqp — pull request #63 by squaremo (2012-01-04 23:17:09+00:00)
Title: Parser improvement

This branch simplifies the parsing and makes it about twice as fast. Largely this is down to not inspecting and copying every byte while reading in a frame; the required length is generally known in advance, so instead it just copies into fresh buffers. (The contents of the frame still have to be parsed of course, but that didn't look at every byte anyway).

It also makes a modest improvement to serialisation by allocating a single buffer per connection and reusing it, rather than allocating a buffer of maxFrameSize every time connection._sendMethod is called.

There are more potential improvements (e.g., by generating serialisation and parsing code procedures for each AMQP method) but this is probably the biggest, or at least the most obvious, bang for buck.

(p.s., sorry about the vestigial cosmetic commits, I hope your git-fu is better than mine ..)