diff --git a/docs/content/index.fsx b/docs/content/index.fsx index adea386..3f767dd 100644 --- a/docs/content/index.fsx +++ b/docs/content/index.fsx @@ -38,19 +38,10 @@ For simple pipelines we have observed performance improvements of a factor of fo Important performance tip: Make sure that FSI is running with 64-bit option set to true and fsproj option prefer 32-bit is unchecked. *) -open Nessos.Streams - let data = [|1..10000000|] |> Array.map int64 // Sequential -// Real: 00:00:00.044, CPU: 00:00:00.046, GC gen0: 0, gen1: 0, gen2: 0 -data -|> Stream.ofArray -|> Stream.filter (fun x -> x % 2L = 0L) -|> Stream.map (fun x -> x + 1L) -|> Stream.sum - // Real: 00:00:00.264, CPU: 00:00:00.265, GC gen0: 0, gen1: 0, gen2: 0 data |> Seq.filter (fun x -> x % 2L = 0L) @@ -63,15 +54,18 @@ data |> Array.map (fun x -> x + 1L) |> Array.sum -// Parallel -open FSharp.Collections.ParallelSeq -// Real: 00:00:00.017, CPU: 00:00:00.078, GC gen0: 0, gen1: 0, gen2: 0 +type NStream = Nessos.Streams.Stream + +// Real: 00:00:00.044, CPU: 00:00:00.046, GC gen0: 0, gen1: 0, gen2: 0 data -|> ParStream.ofArray -|> ParStream.filter (fun x -> x % 2L = 0L) -|> ParStream.map (fun x -> x + 1L) -|> ParStream.sum +|> NStream.ofArray +|> NStream.filter (fun x -> x % 2L = 0L) +|> NStream.map (fun x -> x + 1L) +|> NStream.sum + +// Parallel +open FSharp.Collections.ParallelSeq // Real: 00:00:00.045, CPU: 00:00:00.187, GC gen0: 0, gen1: 0, gen2: 0 data @@ -79,6 +73,16 @@ data |> PSeq.map (fun x -> x + 1L) |> PSeq.sum + +type PStream = Nessos.Streams.ParStream + +// Real: 00:00:00.017, CPU: 00:00:00.078, GC gen0: 0, gen1: 0, gen2: 0 +data +|> PStream.ofArray +|> PStream.filter (fun x -> x % 2L = 0L) +|> PStream.map (fun x -> x + 1L) +|> PStream.sum + (** ## References