Created
June 18, 2020 17:53
-
-
Save Tarmil/e7d0b13f5ad9f72252d4e2d86815775b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 System.Text.Json | |
open System.Text.Json.Serialization | |
open BenchmarkDotNet.Attributes | |
open BenchmarkDotNet.Running | |
type MyUnion = | |
| Foo | |
| Bar of int * string | |
type Unions() = | |
let o = JsonSerializerOptions() | |
do o.Converters.Add(JsonFSharpConverter()) | |
let u = Bar (1, "a") | |
[<Benchmark>] | |
member _.BoleroJson() = Bolero.Json.Serialize(u) | |
[<Benchmark>] | |
member _.SystemTextJson() = JsonSerializer.Serialize(u, o) | |
[<EntryPoint>] | |
let main argv = | |
BenchmarkRunner.Run<Unions>() |> ignore | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment