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

[mscorlib] Prefer using Array.Length as upper for loop limit #8923

Merged
merged 1 commit into from
Jan 12, 2017

Conversation

mikedn
Copy link

@mikedn mikedn commented Jan 12, 2017

The JIT can't eliminate range checks if it can't "see" Length and uses loop cloning which generates a lot of code. Even in cases where not all range checks can be eliminated and loop cloning is used anyway it's still preferable to have fewer range checks.

For example, SortExceptions is ~140 bytes shorter after this change, despite the fact that loop cloning is still being used.

The JIT can't eliminate range checks if it can't "see" Length and uses loop cloning which generates a lot of code. Even in cases where not all range checks can be eliminated and loop cloning is used anyway it's still preferable to have fewer range checks.

For example, SortExceptions is ~140 bytes shorter after this change, despite the fact that loop cloning is still being used.
@danmoseley danmoseley merged commit 01a9eaa into dotnet:master Jan 12, 2017
mikedn added a commit to mikedn/corert that referenced this pull request Jan 15, 2017
jkotas pushed a commit to dotnet/corert that referenced this pull request Jan 15, 2017
manofstick pushed a commit to manofstick/coreclr that referenced this pull request Jan 16, 2017
The JIT can't eliminate range checks if it can't "see" Length and uses loop cloning which generates a lot of code. Even in cases where not all range checks can be eliminated and loop cloning is used anyway it's still preferable to have fewer range checks.

For example, SortExceptions is ~140 bytes shorter after this change, despite the fact that loop cloning is still being used.
@karelz karelz modified the milestone: 2.0.0 Aug 28, 2017
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
The JIT can't eliminate range checks if it can't "see" Length and uses loop cloning which generates a lot of code. Even in cases where not all range checks can be eliminated and loop cloning is used anyway it's still preferable to have fewer range checks.

For example, SortExceptions is ~140 bytes shorter after this change, despite the fact that loop cloning is still being used.

Commit migrated from dotnet/coreclr@01a9eaa
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