Comments (2)
👉Handling null values
* Newtonsoft reads the null as value, and we can edit the converter's read function as we would like to handle null. * Microsoft instead recognizes the null value, and returns it immediately, without even calling the converters read function.[1](#user-content-fn-1%5E-64dc658316f281646fb204ab00f6232c)
This is wrong, there is a setting for it on STJ's side and I fixed it in your PR. It's documented here and it contains a nice explanation as well:
This null-handling behavior is primarily to optimize performance by skipping an extra call to the converter. In addition, it avoids forcing converters for nullable types to check for null at the start of every Read and Write method override.
To enable a custom converter to handle null for a reference or value type, override JsonConverter.HandleNull to return true, as shown in the following example:
🟡 Would replacing all of those with Microsoft Json converters would increase the performance?
Yes, it would decrease the running time and memory usage.
🟡 By a lot?
Not really.
In my mind, this is not really an argument. It depends on use cases. For startup, it gives a non-trivial speedup improvement because Adam wants to load the software in at most 400 ms.
For Backend, the argument should be "how many JSON serialization/deserializations happen" and how much CPU time/memory would be saved.
Is it worth it to burn days and weeks for some (hopefully, at least) seconds of improvements in serializing and deserializing jsons?
You tell me. IMHO, it's not really.
It is worth optimizing where it makes sense. #11840 allows precisely that. It does not force to take any specific action right now. It gives more options and that was the point.
Btw:
- Newtonsoft.JSON is not being actively developed and there is a lot of resources pouring into STJ.
- With STJ, the bet on NativeAOT, app trimming (to decrease app's size) is much better than with Newtonsoft.JSON.
- If we get rid of Newtonsoft, we would have one less dependency, which is not bad either.
- STJ likely will get faster with every release, not true for Newtonsoft.
from walletwasabi.
Useful information thx for the record. Closing it to aggregate the problem into one issue. #4223
from walletwasabi.
Related Issues (20)
- Keeps hanging, HOT 3
- Switch to Taproot by default HOT 8
- Update SECURITY.md HOT 2
- Crashes after a short while HOT 2
- Multiple Wasabi app at the same time HOT 3
- UI glitch on privacy progress. HOT 1
- Still zkSNACKs mentioned everywhere
- Autoupdater shows version 0.0.0 HOT 4
- wasabi wallet HOT 1
- Autoupdater suggests to update but not to the latest version HOT 1
- Label CJs with a coordinator identifier, like domain name.
- No attempt to connect to Tor was successful HOT 1
- Wasabi Wallet v 2.1.0 crashing while in Coinjoin process - OS: Windows 11 Ver 23H2 Build 22631.3880 HOT 5
- Placeholder value for Plebs Don't Pay HOT 1
- New Crash HOT 1
- crash HOT 1
- Hi HOT 5
- cannot build v2.1.0.0 from source: Warning As Error: Package 'System.Text.Json' 8.0.3 has a known high severity vulnerability
- No attempt to connect to Tor was successful. HOT 1
- "Max coordinator fee rate" does not have a unit HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from walletwasabi.