Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Optimize Array.GetLength, GetUpperBound, GetLowerBound - #4993

Merged
jkotas merged 1 commit into
dotnet:masterfrom
jamesqo:patch-6
May 17, 2016
Merged

jkotas merged 1 commit into
dotnet:masterfrom
jamesqo:patch-6

Conversation

@jamesqo

@jamesqo jamesqo commented May 16, 2016 •

Copy link
Copy Markdown

... if the dimension is 0. As the rank will always be >= 1, it's safe to skip calling GetRank (which calls ArrayBase::GetRank, which calls MethodTable::GetRank, which calls GetClass, which looks like it does a bunch of stuff) and the argument validation.

Related PR that made me look into the code to see if any optimizations could be made (by @hughbe): #4988

cc @jkotas @mikedn

... if the argument is 0. As the rank will always be greater, this is safe.
@hughbe

hughbe commented May 16, 2016

Copy link
Copy Markdown

Nice one - I was literally about to do this!

@jamesqo

jamesqo commented May 16, 2016 •

Copy link
Copy Markdown
Author

@hughbe Thanks haha. 😄 I actually was planning to do this for a while now and had forgotten about it, then I saw your PR and remembered.

@jkotas

jkotas commented May 16, 2016

Copy link
Copy Markdown
Member

LGTM. Thanks!

@jkotas

jkotas commented May 16, 2016

Copy link
Copy Markdown
Member

@dotnet-bot test Ubuntu x64 Checked Build and Test please

@jamesqo

jamesqo commented May 17, 2016

Copy link
Copy Markdown
Author

Test OSX x64 Checked Build and Test

@jkotas

jkotas commented May 17, 2016

Copy link
Copy Markdown
Member

@dotnet-bot test OSX x64 Checked Build and Test please

@jkotas
jkotas merged commit ee683a0 into dotnet:master May 17, 2016
@jamesqo
jamesqo deleted the patch-6 branch May 17, 2016 17:35
lucenticus pushed a commit to lucenticus/coreclr that referenced this pull request Jun 3, 2016
... if the argument is 0. As the rank will always be greater, this is safe.
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…r#4993)

... if the argument is 0. As the rank will always be greater, this is safe.

Commit migrated from dotnet/coreclr@ee683a0
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants