[CSHARP-1527] Speed up encoding and decoding of binary BSON CStrings Created: 11/Jan/16  Updated: 23/Sep/16  Resolved: 29/Jan/16

Status: Closed
Project: C# Driver
Component/s: BSON
Affects Version/s: 2.2.1
Fix Version/s: 2.3

Type: Improvement Priority: Minor - P4
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The current implementation of encoding and decoding of binary BSON CStrings takes two passes.

1. When encoding, one pass to encode and a second to verify that the resulting CString has no null bytes
2. When decoding, one pass to find the terminating null byte and a second to decode the UTF8 bytes

Both directions can be sped up by writing a custom UTF8 encoder that uses a single pass.



 Comments   
Comment by Githook User [ 29/Jan/16 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1527: Remove ReadCString refactoring because the performance improvement was negligible. Added tests.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/71d737389c359634f65ec392b120abbb8ab0c89a

Comment by Githook User [ 29/Jan/16 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1527: Speed up encoding and decoding of binary BSON CStrings.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/56009704bd42a5132b980772a0a2d6c2a5a6a1d3

Comment by Robert Stam [ 29/Jan/16 ]

As it turned out we were able to speed up encoding significantly but the improvements to decoding were so minor that we decided to leave decoding alone.

Generated at Wed Feb 07 21:39:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.