-
Type: Task
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: BSON, Performance
In making the changes in NODE-5363, it was identified that since ByteUtils.toLocalBufferType is called directly on user input at both deserializeStream and deserialize, then all of the subsequent calls to ByteUtils.toLocalBufferType which occur inside other ByteUtils helper functions called inside src/parser/deserializer.ts are redundant and should be removed as they have a non-negligible performance impact.
Use Case
As a... driver engineer
I want... to eliminate redundant toLocalBufferType calls
So that... bson string deserialization performance will increase
User Impact
- This change will provide a performance increase in string deserialization
Dependencies
- N/A
Unknowns
- We currently use toLocalBufferType to ensure type safety. How can we maintain type safety in both our web and node implementations of ByteUtils?
Acceptance Criteria
Implementation Requirements
- If possible, ensure that toLocalBufferType is called once and only once for each call to deserialize or deserializeStream, otherwise, eliminate as many calls to toLocalBufferType as possible while preserving type safety
Testing Requirements
- Add unit tests to ensure that toLocalBufferType is called as few times as possible as determined by the answers to the unknowns.
- Manually test performance of string deserialization code paths and check that this does in fact give a performance increase in line with or greater than what was found in the investigation of
NODE-4283.
Documentation Requirements
- N/A
Follow Up Requirements
- additional tickets to file, required releases, etc