Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-4292

Performance: Eliminate allocations in GetHashCode()for all BSON data types

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.18.0
    • Affects Version/s: 2.13.2, 2.17.1
    • Component/s: BSON, Performance
    • None
    • Fully Compatible

      The current GetHashCode() implementations for most BSON data types allocate substantial amounts of memory which can be eliminated easily. Here's the current state in our .NET 4.7.2 process using the .NET Standard 2.0 version of the C# driver:

      This is a boxing issue that be safely eliminated - I'll create a PR in a few minutes for the required change. Here's how things look after the change:

        1. image-2022-08-11-17-40-47-892.png
          image-2022-08-11-17-40-47-892.png
          230 kB
        2. image-2022-08-11-17-41-48-039.png
          image-2022-08-11-17-41-48-039.png
          243 kB
        3. image-2022-08-11-17-44-13-522.png
          image-2022-08-11-17-44-13-522.png
          236 kB
        4. image-2022-08-11-17-45-14-703.png
          image-2022-08-11-17-45-14-703.png
          254 kB

            Assignee:
            james.kovacs@mongodb.com James Kovacs
            Reporter:
            daniel.hegener@gmx.net Daniel Hegener
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: