Skip to content
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

[Performance] Take advantage of new array range check elimination in other collections #20702

Closed
jamesqo opened this issue Mar 21, 2017 · 3 comments
Labels
area-System.Collections enhancement Product code improvement that does NOT require public API changes/additions help wanted [up-for-grabs] Good issue for external contributors tenet-performance Performance related issue
Milestone

Comments

@jamesqo
Copy link
Contributor

jamesqo commented Mar 21, 2017

See dotnet/coreclr#9539 (comment); doing if ((uint)index >= (uint)array.Length) { throw something; } will now elide the range check for array[index] afterwards. Probably won't yield a huge benefit in most placecs, but the perf gains would be essentially free. We should probably do this in collections that are backed by arrays, e.g. here is one place where the new JIT behavior could be put to use.

@karelz
Copy link
Member

karelz commented Mar 22, 2017

So what exactly should happen? Adding that if statement before every loop?
Which types are affected? Only Collections?

@gfoidl
Copy link
Member

gfoidl commented Dec 28, 2017

I see the up-for-grabs and submitted dotnet/corefx#26086 and dotnet/corefx#26087, and though I'm tempted to take it I won't because I don't know how much time I can spent, so the result might not be the one I excpect. Anyway I'll try to help where possible.

@stephentoub
Copy link
Member

This is a very broad recommendation to audit a lot of code looking for small potential improvements. Someone is welcome to do so, but we don't need an issue tracking it. Lots of such improvements get submitted as PRs all the time.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Collections enhancement Product code improvement that does NOT require public API changes/additions help wanted [up-for-grabs] Good issue for external contributors tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

5 participants