Jump to content

Recommended Posts

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
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.

  • Like 1

Share this post


Link to post
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 by pyscripter
  • Like 1

Share this post


Link to post
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
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 by pyscripter
  • Like 1

Share this post


Link to post
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

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 by Stefan Glienke

Share this post


Link to post
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
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
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.

 

 

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×