MarceloHByte 5 Posted September 30 On 5/15/2025 at 1:15 PM, pyscripter said: One thing that strikes me, is that the System.JSON rtl library is doing relatively well compared to the competition, both in terms of performance and in terms of JSON validation. Just confirming, System.JSON had a performance gain (3 times faster) in Delphi version 12, but I haven't researched the reasons. Share this post Link to post
MarceloHByte 5 Posted September 30 On 9/27/2025 at 12:29 PM, pyscripter said: @MarceloHByte Have you also updated JSONDataObjects? There was a significant update after the first post in this topic. I've just updated JsonDataObjects as a Git Submodule. We have a new champion, but it is leaking memory. The Validation test now is clear. 1 Share this post Link to post
pyscripter 850 Posted September 30 (edited) 1 hour ago, MarceloHByte said: I haven't researched the reasons. The only obvious change in System.Json I noticed between Delphi 11 and 12, is the removal of Range and Overflow checking in some performance critical parts. Surprising it makes such a huge difference (3x faster). This may explain the perception about the slowness of System.JSON when using versions earlier than Delphi 12. Edited September 30 by pyscripter 1 Share this post Link to post
MarceloHByte 5 Posted September 30 5 minutes ago, pyscripter said: The only obvious change I noticed is the removal of Range and Overflow checking. Surprising it makes such a huge difference. Maybe these removals explain memory leaking. I think my code is simple enough to not touch delicate parts in terms of overflow, but it is important to mention I'm a C++Builder developer. If you see any bad usage of JsonDataObject, or any other case, please let me know. Share this post Link to post
pyscripter 850 Posted September 30 (edited) 4 minutes ago, MarceloHByte said: Maybe these removals explain memory leaking. I was referring to Delphi's System.JSON and why it got faster in v12 vs v11. JSONDataObjects introduced faster checking for duplicates Performance: Use binary search for finding case sensitive names inste… · ahausladen/JsonDataObjects@4680dc9 that explains the improvement. It would be worth submitting an Issue regarding the memory leaks though. Edited September 30 by pyscripter 1 Share this post Link to post
MarceloHByte 5 Posted September 30 12 minutes ago, pyscripter said: I was referring to Delphi's System.JSON and why it got faster in v12 vs v11. JSONDataObjects introduced faster checking for duplicates Performance: Use binary search for finding case sensitive names inste… · ahausladen/JsonDataObjects@4680dc9 that explains the improvement. It would be worth submitting an Issue regarding the memory leaks though. Sorry, I got confused in the previous comments. By the way, Hausladen is a very skilled developer and JsonDataObjects unit tests are well-constructed, so I'm really suspicious of my code. I'll try to create an isolated example following the structure that I use in TestJSON to try to capture the leaking and then submit to him. On the other hand, the fact that JDO now has clean Validation test may mean that Andy has been looking at my work. 😉 Share this post Link to post
pyscripter 850 Posted September 30 @MarceloHByte Incidentally, which version of Delphi did you use for the benchmarks? Share this post Link to post
MarceloHByte 5 Posted September 30 7 minutes ago, pyscripter said: @MarceloHByte Incidentally, which version of Delphi did you use for the benchmarks? I'm using Delphi 12.1 CE. 1 Share this post Link to post
Stefan Glienke 2190 Posted September 30 (edited) The big performance gain did not happen between 11 and 12, but between 10.2 and 10.3 Additionally, JDO does not leak any memory; it simply does not deallocate when calling TJsonObject.Clear Edited September 30 by Stefan Glienke Share this post Link to post
MarceloHByte 5 Posted September 30 1 hour ago, Stefan Glienke said: The big performance gain did not happen between 11 and 12, but between 10.2 and 10.3 Additionally, JDO does not leak any memory; it simply does not deallocate when calling TJsonObject.Clear Thanks for the update. In my tests, I only checked the performance gain between versions 11 and 12, although I've started with Delphi 10 CE. I'am investigating the memory leak issue with JDO and what I found is that TLibJDO.Destroy is not being called in the finally part of TFormMain.RunTest. Maybe it has something to do with my use of TInterfacedObject. Share this post Link to post
pyscripter 850 Posted September 30 12 minutes ago, MarceloHByte said: Thanks for the update. In my tests, I only checked the performance gain between versions 11 and 12, But you are saying that System.JSON in Delphi 12 is 3x faster than in 11. Am I right? Share this post Link to post
MarceloHByte 5 Posted September 30 2 minutes ago, pyscripter said: But you are saying that System.JSON in Delphi 12 is 3x faster than in 11. Am I right? I probably didn't redo the tests with Delphi versions 10.2 up to 11.3. I'll explain why: using the CE version, the updates were forced, but I still have the executable for each version. In short: System.JSON with Delphi 10.1 has total average time equals to 1546.8 ms (images/Github-03-C-System.JSON.png). Now, version 12.1 it has total average time equals to 431.2 ms (images/Test-Speed-DX-12.1-CE-System.JSON.png). Improvement = 3.6 times faster. That's why I agree with Stefan Glienke's statement that the improvement occurred between versions 10.2 and 10.3. Sorry if I created false hopes between 11 and 12. 1 Share this post Link to post
Vincent Parrett 909 Posted September 30 Added a pull request with VSoft.YAML as a git submodule Share this post Link to post
MarceloHByte 5 Posted Wednesday at 01:01 AM 2 hours ago, Vincent Parrett said: Added a pull request with VSoft.YAML as a git submodule Nice! I'll process it tomorrow. Share this post Link to post
MarceloHByte 5 Posted Wednesday at 12:23 PM 13 hours ago, Vincent Parrett said: Added a pull request with VSoft.YAML as a git submodule Done! Nice results and one more lib with clear results in validation test. Thanks @Vincent Parrett. Share this post Link to post