-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Performance
Use Case
As a Javascript developer
I want BSON serialization to use the best method possible for turning a string into bytes
So that I can serialize JS values quickly
User Impact
- No functional change, performance improvement
Dependencies
- BSON
Unknowns
- What is the turning point for using charCodeAt vs Buffer().write
- Appears to be 25 characters, will attach benchmarks
Acceptance Criteria
Implementation Requirements
- Run benchmarks equivalent to the ones in
NODE-5861and determine what size string performs better in Node's Buffer API - Using charCodeAt turn each character of a string into a byte and write it to the buffer
- If a charCode exceeds 127 fallback to Node's buffer API
Testing Requirements
- Run benchmarks on change
- Unit test
Documentation Requirements
- None
Follow Up Requirements
- Consider reusing the logic for utf8ByteLength when applicable (hot path for bulkWrite)
- related to
-
NODE-5861 Optimize short basic latin string parsing in BSON
- Closed