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

Array.Parallel.Sort* family of functions #14820

Conversation

T-Gro
Copy link
Member

@T-Gro T-Gro commented Feb 27, 2023

This is first part of the RFC to expand the Array.Parallel module, based on approved suggestion

Benchmarks were used for picking an appropriate implementation, comparing againts:
Sequential Array.sort
PLINQ with varying degree of parallelism

Surface area being extended by the following functions.
Main 3 categories:

  • sortBy (projected field)
  • sortWith (custom comparer)
  • sort (using default comparer)

    Microsoft.FSharp.Collections.ArrayModule+Parallel: T[] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], T[])
    Microsoft.FSharp.Collections.ArrayModule+Parallel: T[] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], T[])
    Microsoft.FSharp.Collections.ArrayModule+Parallel: T[] SortDescending[T](T[])
    Microsoft.FSharp.Collections.ArrayModule+Parallel: T[] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], T[])
    Microsoft.FSharp.Collections.ArrayModule+Parallel: T[] Sort[T](T[])
    Microsoft.FSharp.Collections.ArrayModule+Parallel: Void SortInPlaceBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], T[])
    Microsoft.FSharp.Collections.ArrayModule+Parallel: Void SortInPlaceWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], T[])
    Microsoft.FSharp.Collections.ArrayModule+Parallel: Void SortInPlace[T](T[])

@vzarytovskii
Copy link
Member

Same question here: Wondering if the APIs should be marked as Experimental, in case if we'll want to change implementation details later.

@T-Gro
Copy link
Member Author

T-Gro commented Mar 2, 2023

As per #14827 (comment) , I am now more inclined to put the attribute in place here.

@T-Gro T-Gro changed the title Array.Parallel.Sort* family of functions (1/n of additions to this module) Array.Parallel.Sort* family of functions Mar 13, 2023
@T-Gro T-Gro marked this pull request as ready for review March 13, 2023 18:59
@T-Gro T-Gro requested a review from a team as a code owner March 13, 2023 18:59
Copy link
Member

@psfinaki psfinaki left a comment

Choose a reason for hiding this comment

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

Actually, we can probably get some DevDev algorithm gurus to look at all this code.

@vzarytovskii maybe you know someone who can help? Or should we ask @stephentoub right away? :)

@T-Gro T-Gro merged commit aceb22a into dotnet:main Mar 24, 2023
@T-Gro T-Gro deleted the 14217-fsharpcore-collection-functions-for-arrayparallel-more-regular branch March 24, 2023 20:18
kant2002 pushed a commit to kant2002/fsharp that referenced this pull request Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants