[fpc-pascal] Improved FPC JSON-RPC support

Michael Van Canneyt michael at freepascal.org
Wed Dec 29 15:51:30 CET 2021



On Wed, 29 Dec 2021, Graeme Geldenhuys via fpc-pascal wrote:

> On 2021-12-29 09:54, Michael Van Canneyt via fpc-pascal wrote:
>> They showed clearly that the used protocol (http & xml) is the largest 
>> factor.
>> in 2013 I did many tests in a JSON REST framework: the times for 
>> streaming were dwarfed by the time spent on network & database access.
>
> Have you, or anybody else, ever done some benchmarks to see how 
> "expensive" in CPU time it is to parse the exact same data in XML format 
> vs JSON format?
>
> I couldn't find FPC specific benchmarks, but did a basic Firefox v95.0.2 
> browser Network tests (with caching disabled). A 54KB JSON file vs a 
> 121KB XML file, which represents the exact same 1000 rows of a database 
> table. Interestingly (and surprising to me), Firefox managed to load the 
> XML in about half the time (172ms) compared to the JSON (386ms) file. I 
> did the load test multiple times, and the results were consistent.

It depends on how you load it. It's quite possible the XML uses a SAX model
where the nodes are not loaded till you actually access them.
So I would definitely also add a loop that runs over all rows.

I did a test once on pure FPC, and there the JSON worked faster.

Michael.


More information about the fpc-pascal mailing list