Replies: 1 comment
-
Short answer is because of how comparison works in F# historically (see |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I was doing some tests with BenchmarkDotNet to try to figure out if there are differences when using different comparison methods.
Here is the code that I used:
And here are the results I got:
Now my question is, why is using
compare
so much faster than using the naive comparison with<
? It also seems like implementing custom comparison removes this performance benefit and only way to get similar performance is to upcast toSystem.IComparable<_>
and only then do the comparison. Why is there such difference between the automatically implemented comparison and the custom comparison?Beta Was this translation helpful? Give feedback.
All reactions