Optimize short basic latin string parsing in BSON

XMLWordPrintableJSON

    • 3
    • Not Needed
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a javascript engineer
      I want to improve the performance of parsing <20 byte basic latin strings in BSON
      So that BSON keys and short string values decode faster

      User Impact

      • Basic Latin strings should decode faster than before this change

      Dependencies

      • None

      Unknowns

      • None

      Acceptance Criteria

      Implementation Requirements

      • Use String.fromCharCode if bytes are between [0, 127] and sequences are less than 20 bytes
      • Refactor UTF8 validation to occur iff bytes exceed the above range

      Testing Requirements

      • Run benchmarks
      • Ensure byte sequences that contain a byte greater than 127 still operate

      Documentation Requirements

      • None

      Follow Up Requirements

      • None

        1. micro_bench_latin.txt
          18 kB
        2. resultsCollected-bson-latin-optimization.json
          243 kB
        3. resultsCollected-bson-main.json
          239 kB

              Assignee:
              Neal Beeken
              Reporter:
              Neal Beeken
              Durran Jordan
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: