-
Notifications
You must be signed in to change notification settings - Fork 936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize PersistentGenericSet snapshot #2394
Conversation
} | ||
if (_syncRoot == null) | ||
{ | ||
Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used the same logic as List<>
has.
Maybe we stick to the dictionary to avoid using conditional compilation? |
Also, hibernate just uses |
Co-authored-by: Frédéric Delaporte <12201973+fredericDelaporte@users.noreply.github.com>
Co-authored-by: Frédéric Delaporte <12201973+fredericDelaporte@users.noreply.github.com>
Hibernate is using HashMap, which supports null keys, so I think we should too.
To me using a dictionary is only a temporary solution until we upgrade to .NET Standard 2.1 or higher as |
This reverts commit 0ac69bd.
Is it possible to add unit tests for SetSnapshot (but no reflection please)? |
Tests added. |
An alternative approach of #2393, which uses
HashSet<T>.TryGetValue
for .Net Core and a dictionary for .NET Framework