Rethink performance

Lots of performance improvements to the rethinkdb esm.