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
Switch to using the BCL HashCode type #16069
Conversation
@roji Looks good to me. FYI @AndriySvyryd @smitpatel @bricelam @maumar Any concerns? For the service provider hashing, see #13437. It's 64-bits to allow for more entropy, but it's unclear whether it really helps. |
Ah, I think I understand now - the hash code is being used as the actual key, as opposed to the standard way of having the object as the key (IDbContextOptions in this case), in which case there's an Was it done this way for perf reasons or something? |
@roji It has a...history. ;-) It's certainly not something I am completely happy with, but it's also not clear how much value there is in re-working it. |
😆 OK. If we did want to change this, now would be a good time as changing the return value from long to int would be a breaking change. |
@roji That's true...but we could always postpone that change since we can still use a long type but with 32 unused bites. ;-) |
Sure, but if we're OK with having only 32-bits, we might as well just change the type to int now and do the breaking change, no? |
@roji I'm not okay with changing to 32-bits using the current design. |
Yeah, very understandable if you guys have already had some collisions. I may think about this a bit, but nothing urgent obviously. |
src/EFCore.Relational/Storage/TypedRelationalValueBufferFactoryFactory.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Relational/Query/Pipeline/SqlExpressions/SqlBinaryExpression.cs
Outdated
Show resolved
Hide resolved
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.
Also remove allocations from GetHashCode() methods by refraining from using LINQ.
Converted a few more foreach's to for's and squashed, will merge after build. |
Also remove allocations from GetHashCode() methods by refraining from using LINQ.
Notes:
Aggregate()
(or other LINQ) since we don't really wantGetHashCode()
to allocate.HashCode
there as well?base.GetHashCode()
, I simply passed that valueHashCode.Combine()
in the subclass. That means double-hashing occurs, which I think should be OK (opinions/insights??). Otherwise we'd need to expose getting aHashCode
instance from base classes (not even possible with base classes we don't own, e.g. Expression).