[CSHARP-4300] Reduce memory traffic associated with Hasher.cs Created: 19/Aug/22 Updated: 24/Aug/23 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Unknown |
| Reporter: | Boris Dogadov | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
Follow up for https://jira.mongodb.org/browse/CSHARP-4292
|
| Comments |
| Comment by Daniel Hegener [ 24/Aug/23 ] | |
|
Turning Hasher into a struct isn't trivial (but feasible) because of the fluent API that it contains. Passing references back to "this" will cause the struct to be copied every time. Also, there is some more boxing-induced allocation going on in the current implementation, e.g. when passing a List<T> into
How about switching to System.HashCode altogether? This would remove all allocations and arguably provide even better hash codes. |