Created
July 27, 2014 15:05
-
-
Save palladin/c34a3a761f755b57244c to your computer and use it in GitHub Desktop.
ParStream.sortBy performance test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#time | |
#r "bin/Release/Streams.Core.dll" | |
open Nessos.Streams.Core | |
let rnd = new System.Random() | |
let data = [|1..10000000|] |> Array.map (fun _ -> int64 <| rnd.Next(1000000)) | |
#r "../../packages/FSharp.Collections.ParallelSeq.1.0/lib/net40/FSharp.Collections.ParallelSeq.dll" | |
open FSharp.Collections.ParallelSeq | |
// Real: 00:00:03.095, CPU: 00:00:14.679, GC gen0: 3, gen1: 2, gen2: 2 | |
data | |
|> PSeq.map (fun x -> x + 1L) | |
|> PSeq.sortBy id | |
|> PSeq.toArray | |
// Real: 00:00:00.917, CPU: 00:00:04.321, GC gen0: 1, gen1: 0, gen2: 0 | |
data | |
|> ParStream.ofArray | |
|> ParStream.map (fun x -> x + 1L) | |
|> ParStream.sortBy id |
Ah, I see. Thanks for the detailed explanations!
Btw, it might be helpful to add that explanation to the readme. First time I discovered your Streams API and read "inspired by Java 8 Streams" I didn't understand what makes Java 8 Streams special since it I thought that Java 8 Streams were just the Java version of Seq/IEnumerable+LINQ.
Great suggestion, thnx for the feedback!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes "optimized" in cotl is about ScalaBlitz and LinqOptimizer.