This repository was archived by the owner on Nov 13, 2026. It is now read-only.
Repository navigation
Implement efficient Array.IndexOf - #4977
Merged
Merged
Conversation
jkotas
reviewed
Nov 21, 2017
| } | ||
| case "Array": | ||
| { | ||
| if (methodName == "GetComparerForReferenceTypesOnly") |
Member
There was a problem hiding this comment.
Nit: It would be nice to not have these intrinsics on Array. Array has a ton of random stuff in it. The less random stuff is dumped into it, the better. I think EqualityComparerHelpers would be a better place for them. (This would need to be adjusted in ProjectN too, of course.)
This is the remainder of dotnet#4935. We special case a couple methods on Array to avoid allocating a full EqualityComparer per each array type. This saves 22 kB on hello world (comparers for a bunch of primitive types and enums). Same as in dotnet#4935 - we restrict the optimization to non-shared value types. On Project N we would also optimize shared valuetypes, but these are rare enough that it's probably not worth building the infrastructure for. Fixes dotnet#763.
MichalStrehovsky
force-pushed
the
structOnlyEquals
branch
from
November 21, 2017 18:42
02193f8 to
e27d18c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the remainder of #4935.
We special case a couple methods on Array to avoid allocating a full EqualityComparer per each array type. This saves 22 kB on hello world (comparers for a bunch of primitive types and enums).
Same as in #4935 - we restrict the optimization to non-shared value types. On Project N we would also optimize shared valuetypes, but these are rare enough that it's probably not worth building the infrastructure for.
Fixes #763.