Skip to content

Instantly share code, notes, and snippets.

@bohdanszymanik
Last active April 26, 2017 20:22
Show Gist options
  • Save bohdanszymanik/072b5f26b4c1713de88f7031afc515ac to your computer and use it in GitHub Desktop.
Save bohdanszymanik/072b5f26b4c1713de88f7031afc515ac to your computer and use it in GitHub Desktop.
// running in fable.io/repl to check performance on 32 bit win 7 with chrome
type Agent<'T> = MailboxProcessor<'T>
let agent =
Agent.Start(fun inbox ->
async { while true do
let! msg = inbox.Receive()
printfn "got message '%s'" msg } )
agent.Post "hello"
let agents =
[for i in 0..100000 ->
Agent.Start(fun inbox ->
async { while true do
let! msg = inbox.Receive()
printfn "%d got message '%s'" i msg } )
]
agents.[8].Post "here"
agents.[80].Post "here"
agents.[800].Post "here"
agents.[8000].Post "here"
// this is where it get's noticeably slow on win 7 32bit pc,
agents.[80000].Post "here"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment