Remove potentially redundant creation of Long class when parsing Date()

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON, Performance
    • Not Needed
    • None
    • 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?
    • None
    • None
    • None
    • None
    • None
    • None

      First suggested here: https://github.com/mongodb/js-bson/pull/611#issuecomment-1942706746

      Use Case

      As a BSON user
      I want Dates to decode as quickly as possible
      So that my app is more resonsive

      User Impact

      • Performance improvement for parsing Dates

      Dependencies

      • None

      Unknowns

      • The Long's construction and toNumber() calls appear redundant but do they provide value?
        • toNumber has some form of implicit truncation and precision loss
        • Note: JS Date's cannot be greater than 8640000000000000 nor less than -8640000000000000

      Acceptance Criteria

      Implementation Requirements

      • Parse Dates without creating a throw-away Long object

      Testing Requirements

      • Ensure Date's are constructed correctly and without extraneous objects

      Documentation Requirements

      • None

      Follow Up Requirements

      • None

            Assignee:
            Unassigned
            Reporter:
            Neal Beeken
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: