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

Improve BSON serialization performance

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • bson-6.9.0
    • Affects Version/s: None
    • Component/s: BSON
    • 2
    • 2
    • Not Needed
    • 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?

      During extensive benchmarking of BSON serialization/deserialization performance to test  NODE-6246 I found that most document properties cause multiple calls to `Object.prototype.toString.call(prop)` which are quite expensive. By refactoring the serialization checks to move these calls out of hot paths could result in ~20% serialization performance (testing with MFlix dataset). By also integrating a WeakMap cache to essentially memoize calls to `Object.prototype.toString.call(prop)` can increase performance of serialization and calculateSize to 20-40%.

      https://github.com/mongodb/js-bson/pull/709

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            reece.sean@gmail.com Sean Reece
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: