Adding Parallel Extensions to F#, from Matt Podwysocki

Matt has a lovely post showing how to define parallel sequences in F#:

In many of my presentations lately, I’ve been using the Parallel Extensions for .NET as part of my heavy computations in F#.  By doing so, I’m able to speed up some of my heavier computations by several fold and take full advantage of my machine.  Over time, with the help of others, I’ve translated many of the functions from the ParallelEnumerable class into those that can easily be consumed by F# in a meaningful way. 

<insert some lovely code>

That’s it.  That’s all there is to it.  Now we can do such simple examples as the following:

> pseq [1..1000] |> ((*) 2) 
    |> PSeq.filter(fun x -> x % 3 = 0) 
    |> PSeq.sum_by_int;;

val it : int = 333666



Comments (1)

  1. Pavel Minaev says:

    This sounds like a good candidate for inclusion into the PowerPack…

Skip to main content