-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Update ValueType.xml #3226
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
Update ValueType.xml #3226
Conversation
|
/cc @mairaw @rpetrusha |
|
Changes look good @AaronRobinsonMSFT. Is this behavior true for both .NET Core and .NET Framework? |
|
@mairaw Yes. |
rpetrusha
left a comment
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.
Thanks, @AaronRobinsonMSFT. I'll merge this PR now.
|
Is this correct? I'm probably wrong but the documentation now says that: But according to #13164 .Net core implementation of ValueType.Equals calls Equals on all fields only if the Type contains Reference type or Float or Double or user defined ValueType that overrides Equals method. If Type does not contain any of these Bitwise check is performed. Also this beahavior doesn't seem to be true for both .NET Core and .NET Framework. |
This is an performance optimization. It does not affect the observable behavior. We typically do not document performance optimizations.
You are right that some versions of .NET Framework and early versions of .NET Core had a bug in this performance optimization that affected observable behaviors. Do you think it is important to document this bug? |
It may introduce breaking changes for people migrating from .NET Framework to .NET Core.
If I read this documentation I would immediately assume that this algorithm is very slow because it always uses reflection and therefore I should never use it. But it is actualy a viable choise in many situations. But I must agree that this probably isn't good enough reason for adding it to documentation. I can imagine that .NET makes many undocumented optimizations such as this one. And I don't see why this specific one should be documented. |
Summary
Remove language about possible optimizations in
ValueType.Equalsimplementation.Fixes https://github.com/dotnet/coreclr/issues/26833
/cc @jkotas @tannergooding