Skip to content

Instantly share code, notes, and snippets.

@davidgrenier
Created March 7, 2014 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidgrenier/9414013 to your computer and use it in GitHub Desktop.
Save davidgrenier/9414013 to your computer and use it in GitHub Desktop.
Erlang Ring Rx new
#r @"C:\Projects\Lib\System.Reactive.Interfaces.dll"
#r @"C:\Projects\Lib\System.Reactive.Core.dll"
#r @"C:\Projects\Lib\System.Reactive.Linq.dll"
open System
open System.Linq
open System.Reactive.Subjects
open System.Reactive.Linq
let run n m =
let now = DateTime.Now
let nodes = List.init n (fun _ -> new Subject<_>())
nodes.[nodes.Length - 1]
.Finally(fun () -> printfn "Completed in %f" (DateTime.Now - now).TotalSeconds)
.RunAsync(Threading.CancellationToken.None) |> ignore
Seq.iter2 (fun l r -> (l :> IObservable<_>).Subscribe(r) |> ignore) nodes nodes.Tail
Seq.init m id |> Seq.iter nodes.Head.OnNext
nodes.Head.OnCompleted()
run 10000 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment