Skip to content

Instantly share code, notes, and snippets.

@palladin
Created August 5, 2014 15:51
Show Gist options
  • Save palladin/66d93ff825402f1af15e to your computer and use it in GitHub Desktop.
Save palladin/66d93ff825402f1af15e to your computer and use it in GitHub Desktop.
ParStream.groupBy performance test
#time
#r "bin/Release/Streams.Core.dll"
open Nessos.Streams.Core
let data = [|1..10000000|] |> Array.map (fun i -> int64 <| (i % 1000000))
#r "../../packages/FSharp.Collections.ParallelSeq.1.0/lib/net40/FSharp.Collections.ParallelSeq.dll"
open FSharp.Collections.ParallelSeq
// Real: 00:00:03.390, CPU: 00:00:06.910, GC gen0: 240, gen1: 63, gen2: 2
data
|> PSeq.map (fun x -> x + 1L)
|> PSeq.groupBy id
|> PSeq.length
// Real: 00:00:01.272, CPU: 00:00:03.712, GC gen0: 81, gen1: 21, gen2: 0
data
|> ParStream.ofArray
|> ParStream.map (fun x -> x + 1L)
|> ParStream.groupBy id
|> ParStream.length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment