Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5909

Optimize short basic latin string writing in BSON

    • Hide

      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.

      Show
      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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-5861 and 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)

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: