-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Add in-place sorting methods to OrderedDictionary #103579
Comments
Tagging subscribers to this area: @dotnet/area-system-collections |
Can you point to where? And would it actually need Move? It's quite possible the fastest implementation would just sort the Entry list and then throw away and recreate the buckets. |
Sure: runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.cs Line 1137 in 7e977dc
The |
And it'd be ok for it to not be a stable sort? |
In this case stability is a requirement (it would change the semantics of the |
We could perhaps make stability opt-in by feeding the index into the comparer? |
Then you couldn't use |
An in-place stable sorting implementation is something we're sorely missing at the moment. We could start by adding it to array and span, then work our way up to List-like types. |
I'm fine with that, but I wouldn't want to add this API until that existed, we figured out naming conventions, there was something for this to depend on and use, etc. You marked this as 9.0; will you be pushing for a stable sort up and down the stack for 9 as well? |
Let's keep it as a suggestion for now. |
We could still expose Move (and/or Swap) if that would be the deal breaker with STJ using this type in 9. |
Originally posted by @kronic in #103309 (comment)
An in-place, stable sorting method in particular would be very useful in the context of using OrderedDictionary in System.Text.Json
cc @stephentoub
The text was updated successfully, but these errors were encountered: