Skip to content

Avoid boxing in Range equality comparisons #6048

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

Merged
merged 4 commits into from
Dec 22, 2018
Merged

Avoid boxing in Range equality comparisons #6048

merged 4 commits into from
Dec 22, 2018

Conversation

cartermp
Copy link
Contributor

@cartermp cartermp commented Dec 21, 2018

Replaces equality comparisons with ranges via = and <> to use a new function, Range.equals. This function is the same as the overridden Equals member. The reason is because = and <> on ranges actually end up boxing every range.

@cartermp

This comment has been minimized.

@cartermp cartermp changed the title Range equality Avoid boxing in Range equality comparisons Dec 21, 2018
@TIHan TIHan merged commit 66b20f9 into dotnet:dev16.0 Dec 22, 2018
@TIHan
Copy link
Contributor

TIHan commented Dec 22, 2018

This is great

@@ -56,6 +56,8 @@ val mkFileIndexRange : FileIndex -> pos -> pos -> range
/// This view hides the use of file indexes and just uses filenames
val mkRange : string -> pos -> pos -> range

val equals : range -> range -> bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider putting NoEquality and NoComparison on the range struct?

Also another option is to use open NonStructuralComparison more commonly, which at least flushes out places where structural comparison and equality are being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've considered doing it, just haven't gotten around to it yet :)

Seems like a fine thing to do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is actually fairly icky work, but I have a branch that I'll throw up in PR at some point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants