[fpc-pascal] Tests results of several pascal based JSON parsers

Michael Van Canneyt michael at freepascal.org
Fri Aug 30 11:15:55 CEST 2019



On Fri, 30 Aug 2019, Anthony Walter wrote:

> I've posted a new page that tests the speed and correctness of several
> pascal based JSON parsers.
>
> https://www.getlazarus.org/json/tests/
>
> In full disclosure I am the author of the new open source JsonTools
> library, and even though my parser seems to a big improvement over the
> other alternatives, my tests were not biased.

Test are always biased in the sense that they depend on the proficiency of
the coder. you must ask someone with sufficient knowledge to write the code.

The shootout benchmarks for example are dismally coded for FPC with as a
result that they perform badly.

So it could well be that the fpJSON results for example can be improved a
lot by changing the method used to a more efficient one.

Also, not every library is designed with the same goals.
fpjson could probably be made smaller if the goal was more focused.
it has a factory pattern, added on behalf of users who asked for this. 
jsontools does not have this. 
You can format the output. JSONTools does not have this.
fpJSON was designed to be pluggable wrt. parsing. JSONTools is not.

In short fpjson can do a lot more than JSONtools. 
Some things come at a price, others not.

In that sense, tests like this compare apples with pears.

> If anyone would like help in replication the tests, let me know and I'll
> see what I can do.
>
> Also, to be thorough, you should read through both the article I posted at
> the top this message, and my original page <https://www.getlazarus.org/json>
> which has been updated with more information. Both pages took some time to
> write, and I promise if you read through them some of your questions will
> be answered without having to ask others for help or insight.

Can you please send me the testcode you used for your speed & correctness tests ?

I'm a bit surprised to see fpJSON fail in unicode correctness. It's been
tested extensively, maybe your code contains errors (or maybe fpjson does,
I'll need to check).

Also please explain what 'Handling duplicate key names correctly' means to you. 
Saying that a library fails a test without specifying what the test is, is
strange.

Michael.


More information about the fpc-pascal mailing list