Skip to content

Instantly share code, notes, and snippets.

@Szer
Last active August 21, 2017 10:09
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 Szer/47fd81a47910b46393690ed0424267a8 to your computer and use it in GitHub Desktop.
Save Szer/47fd81a47910b46393690ed0424267a8 to your computer and use it in GitHub Desktop.
module Test
open System
open System.Threading.Tasks
open System.Diagnostics
open BenchmarkDotNet
open BenchmarkDotNet.Running
open BenchmarkDotNet.Attributes
let f input =
async {
let! await = input
return 1 + await
}
type Worker() =
[<Benchmark>]
member public x.DoWork() =
let src = async { return -1 }
let first = f src
let mutable output = first
for i = 1 to 100000 do
let input = f output
output <- input
output
|> Async.Ignore
|> Async.RunSynchronously
[<EntryPoint>]
let main argv =
let summary = BenchmarkRunner.Run<Worker>()
printfn "%A" summary
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment