mongodb/mongo-csharp-driver — pull request #101 by optimiz3 (2012-04-29 06:26:32+00:00)
Title: Update CSHARP-452 (Improve deserialization performance)

Robert and I had been discussing CHARP-4522 and we accidentally both implemented this separately. This merges the best parts from both of our work. (My original implementation can be found here https://github.com/optimiz3/mongo-csharp-driver/commit/f1652202981ff87c715caf9ca8777cf9718a65d4.)

This change uses an O(1) bit array when determining which elements have been deserialized. One trick it uses is leveraging how .Net default initializes array values to 0 for the bit array. It also significantly enhances sparse structure processing.

After running several tests I found this improved deserialization performance by an average 7% in the dense structure case and an average 27% in the sparse structure case over the current build in mainline.