This repository was archived by the owner on Nov 13, 2026. It is now read-only.
Repository navigation
Cache the Rank in GetUpper/LowerBound - #1282
Merged
Merged
Conversation
Member
There was a problem hiding this comment.
We do not use MDArray.cs for CoreRT so there is no good way to test it, and we are on path to eliminate it completely - could you please revert the MDArray related changes?
Member
|
LGTM. Thanks! |
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.
After dotnet/coreclr#4993, I decided to take a look at the corert implementation of
Array.GetLowerBound(and others) to see if any similar optimizations could be made here.Changes:
ArrayGetLowerBound,GetUpperBoundArray.Copy: Don't get the rank if the EETypePtrs are the sameMDArrayCheckBoundsmethods (multiplethrow new ...means mutliple throws will be in the generated IL, not sure how the AOT compiler handles this)Initialize: When you're checking if something is negative, you're really checking if it's highest bit is set. Therefore, we can just AND everything and check if it's != 0 to check if any of the arguments are negative (again, please let me know if this is taken care of by the AOT compiler and if I should revert this)cc @jkotas