The set in there is unnecessary. Use the hash itself as "set". This makes BSON::OrderedHash 148% faster on Ruby 1.8.