Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve performance of CB GetFirstPassWriter
Some performance testing showed a regression in Compact Binary v1 performance after support for v2 was added. The biggest contributor to the regression was boxing being done in CompactBinaryWriter.GetFirstPassWriter. The previous implementation of CompactBinaryWriter.GetFirstPassWriter, when v1 was being used, was boxing a null to a Nullable<CompactBinaryCounter> and then converting that to a null IProtocolWriter. With this change, the version 1 code path just returns a null IProtocolWriter, avoiding the expensive box. The performance difference on the test I was using is now negligible.
- Loading branch information