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

Investigate string decoding performance optimizations

      Investigation

      TextDecoder decode vs Buffer toString.
      Buffer.toString performs better on small inputs, textdecoder performs better on large inputs, look into a way of potentially using either or both to improve BSON decoding.

      See attached benchmark file

      downloaded utf8: 13737 bytes
      small exmp utf8: 96 bytes
      large Buffer toString x 13,435 ops/sec ±0.62% (93 runs sampled)
      large TextDe decode   x 25,839 ops/sec ±0.83% (93 runs sampled)
      small Buffer toString x 1,871,376 ops/sec ±0.54% (96 runs sampled)
      small TextDe decode   x 312,321 ops/sec ±7.32% (49 runs sampled)
      Fastest is small Buffer toString
      

        1. main.js
          1 kB
          Neal Beeken

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

              Created:
              Updated: