Welcome to MSDN Blogs Sign in | Join | Help

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] |> PSeq.map ((*) 2) 
    |> PSeq.filter(fun x -> x % 3 = 0) 
    |> PSeq.sum_by_int;;
 
val it : int = 333666
 
 
Published Friday, February 27, 2009 4:09 PM by dsyme

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Monday, March 09, 2009 7:32 PM by Pavel Minaev

# re: Adding Parallel Extensions to F#, from Matt Podwysocki

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

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker