Nick Randell
Nick Randell

Reputation: 18305

Is PSeq the correct approach to use in F# 3.0?

I've been using the F# powerpack for some time and it's got the great PSeq module in and it works really well.

However it doesn't smell correct as this is an extension to the F# libraries, rather than a standard library. Is there a more 'correct' way to perform general parallelism in F#?

I know this is quite a general question, but I can't seem to find a definitive answer anywhere else that is recent (eg 2013)

Upvotes: 3

Views: 722

Answers (1)

Tomas Petricek
Tomas Petricek

Reputation: 243096

As mentioned in the comments the PSeq module is just a thin wrapper over the Parallel LINQ library. The main purpose is to give you a nice syntax, compatible with pipelining and the style used with Seq and other standard modules.

So, if Parallel LINQ is the right thing in your case, then PSeq module is the best way to use it from F#. That said, PLINQ only improves the performance if your collections have the right structure - you need to process fairly large collections and the operations that you are running are non-trivial (otherwise, there is a lot of overhead).

Also, the easiest way to use PSeq is probably just to copy PSeq.fs and PSeq.fsi into your project (they are part of the F# PowerPack, but if you only care about PSeq, then copying the two files is all you need).

Upvotes: 1

Related Questions