Hongli Lai (FooBarWidget@GitHub) worked on some improvements of the MongoDB Ruby driver:
The Ruby driver was quite inefficient with handling data. Strings (read from the network or passed by the user) were being unpacked into arrays all over the place and vice versa. We’ve modified the driver to work with strings instead of byte arrays as much as possible. Most notably:
ByteBufferhas been rewritten to use a binary string as underlying storage object instead of an array.
The Ruby 1.8 implementation of
BSON::OrderedHashwas inefficient: it uses a Set even though it’s not necessary. We removed the dependency on Set and greatly improved
OrderedHash’s 1.8 performance.
The end result is a driver that’s 274% faster on Ruby 1.8 and 204% faster on Ruby 1.9.