-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Performance optimisations: Using more value-types and structs #68
base: master
Are you sure you want to change the base?
Conversation
The figures are still so bad that people should prefer System.Text.Json and Newtonsoft.Json over this library. |
Yes, far too many moving parts |
I asked @eiriktsarpalis the best method for custom parsing json with System.Text.Json, he said:
So I tried a bit: https://gist.github.com/Thorium/09a67ce08adee4fcc02ec7f0048e6962 |
I should mention though - while GC and perf for STJ is in another league, ultimately the perf of JSON serialization is not make or break for 99% of systems. i.e. my motivations for mentioning other libs is not primarily based on perf, more:
|
Fair point, however often JSON is used in data communications which often means there is either active user looking progress-bar, or there is a huge batch process going on, so speed is somewhat a property. Beside the options you mentioned there is FSharp.Data.JsonProvider which is extremely convenient to use, having its own parser. Right now I feel that F# eco-system has had this problem of everyone copy&pasting their own serialization implementations (and AI-tools will make this even easier in the future). And because everything is OSS, people also referencing single serialization-implementation files directly (e.g. paket files). That's why fixing old code is important even in old less-maintained sources. |
This commit reduces the memory usage and speeds up all the serialization.
I used also the benchmark-branch all the test that did have result for FSharp.Json,
to run test between the current version and this commit, both run with latest FSharp.Core.
Here are the results: