Last active
August 21, 2017 10:09
-
-
Save Szer/47fd81a47910b46393690ed0424267a8 to your computer and use it in GitHub Desktop.
This file contains 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
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