Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance comparison #1

Open
brettrowberry opened this issue May 27, 2020 · 2 comments
Open

Performance comparison #1

brettrowberry opened this issue May 27, 2020 · 2 comments

Comments

@brettrowberry
Copy link

How does the performance compare to other JSON serializers available in F#?

@pimbrouwers
Copy link
Owner

Sounds like a good idea for a PR ;)

@Numpsy
Copy link

Numpsy commented Mar 26, 2023

Not sure how much of a direct comparison this is, but as an example, if I have a benchmark like

        [Benchmark]
        public Jay.Common.Json ParseWithJay()
        {
            return Jay.Json.Json.parse(jsonText);
        }

        [Benchmark]
        public System.Text.Json.JsonDocument ParseWithJsonDocument()
        {
            return System.Text.Json.JsonDocument.Parse(jsonText);
        }

        [Benchmark]
        public Newtonsoft.Json.Linq.JObject ParseWithJObject()
        {
            return Newtonsoft.Json.Linq.JObject.Parse(jsonText);
        }

and I run it with the json file from https://github.com/danipen/TextMateSharp/blob/master/src/TextMateSharp.Grammars/Resources/Grammars/csharp/syntaxes/csharp.tmLanguage.json (~108KB of Json) then I get this:

Job=.NET 7.0  Runtime=.NET 7.0

|                Method |       Mean |    Error |   StdDev |     Gen0 |     Gen1 |    Gen2 |  Allocated |
|---------------------- |-----------:|---------:|---------:|---------:|---------:|--------:|-----------:|
|          ParseWithJay |   501.5 us |  9.75 us |  9.12 us | 101.0742 |  69.8242 |       - |   621.2 KB |
| ParseWithJsonDocument |   377.1 us |  4.46 us |  3.48 us |  83.0078 |  83.0078 | 83.0078 |  256.19 KB |
|      ParseWithJObject | 1,302.7 us | 25.67 us | 46.29 us | 246.0938 | 218.7500 |       - | 1515.61 KB |

I haven't used it for writing Json, so I haven't tested that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants