[fpc-pascal] Tests results of several pascal based JSON parsers
Benito van der Zander
benito at benibela.de
Sat Aug 31 11:11:33 CEST 2019
Hi,
when I need maximal speed, I use jsonscanner of fpJSON. It should be
vastly faster than a complete parser by not allocating memory or
validating the json.
Although it decodes all the strings in the JSON, which require some
allocations, even if you do not need every string.
It would be faster, if it would just set a (pchar, length) pair for each
string. The CurTokenString property could be changed from returning the
already decoded string to a method decoding the string only when the
property is read.
Best,
Benito
Am 30.08.19 um 11:15 schrieb Michael Van Canneyt:
>
>
> 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.
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list