[CSHARP-4292] Performance: Eliminate allocations in GetHashCode()for all BSON data types Created: 11/Aug/22 Updated: 28/Oct/23 Resolved: 24/Aug/22 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | BSON, Performance |
| Affects Version/s: | 2.13.2, 2.17.1 |
| Fix Version/s: | 2.18.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Daniel Hegener | Assignee: | James Kovacs |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Description |
|
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:
|
| Comments |
| Comment by Githook User [ 24/Aug/22 ] |
|
Author: {'name': 'James Kovacs', 'email': 'jkovacs@post.harvard.edu', 'username': 'JamesKovacs'}Message: Added Daniel Hegener <daniel.hegener@fisglobal.com> to contributors list for |
| Comment by Boris Dogadov [ 16/Aug/22 ] |
|
Thanks daniel.hegener@gmx.net, |
| Comment by Daniel Hegener [ 11/Aug/22 ] |