Last active
August 13, 2021 19:46
-
-
Save bjartwolf/fa18e643da4fa57b33407db37a0e66b7 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
open BenchmarkDotNet.Attributes | |
open BenchmarkDotNet.Running | |
open FSharp.Control.Tasks.V2 | |
open System.Threading.Tasks | |
open System.Net.Http | |
open System.Net | |
open System | |
type Benchmarks() = | |
let httpClient = new HttpClient() | |
[<Benchmark>] | |
member this.Foo() : Task<unit> = | |
task { | |
let message = new HttpRequestMessage() | |
message.Method <- HttpMethod.Head | |
message.RequestUri <- Uri("https://someurlthing.com") | |
let! response = httpClient.SendAsync(message) | |
if (response.StatusCode <> HttpStatusCode.OK) then failwith "oopsy" | |
else return () | |
} | |
[<EntryPoint>] | |
let main argv = | |
BenchmarkRunner.Run<Benchmarks>() |> ignore | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment