#1 2015-02-01 13:06:14

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,662
Website

Benchmarking QDAC3 JSON parser

Do you know QDAC3 ?
This is an open source project, from China (with Chinese comments and exception errors messages, but the methods and variables are in English).
It is cross-platform, and told to be very fast about JSON process.

So I included QDAC3 in our "25 - JSON performance" sample.
See http://synopse.info/fossil/info/e758ebb6c0

Here are some numbers, compiled with XE7 under Win32:

   JSON benchmarking
  -------------------

1. Small content

 1.1. Synopse record:
  - Read: 50,000 assertions passed  158.31ms  315,822/s
  - Access: 100,000 assertions passed  795us  62,893,081/s
  - Write: 50,000 assertions passed  111.58ms  448,088/s
  Total failed: 0 / 200,000  - Synopse record PASSED  271.46ms

 1.2. Synopse variant:
  - Read: 50,000 assertions passed  364.70ms  137,096/s
  - Access direct: 100,000 assertions passed  61.71ms  810,149/s
  - Access late binding: 100,000 assertions passed  722.41ms  69,212/s
  - Write: 50,000 assertions passed  218.17ms  229,174/s
  Total failed: 0 / 300,000  - Synopse variant PASSED  1.36s

 1.3. Synopse cross platform variant:
  - Read: 50,000 assertions passed  642.89ms  77,773/s
  - Access direct: 100,000 assertions passed  38.80ms  1,288,560/s
  - Access late binding: 100,000 assertions passed  627.81ms  79,641/s
  - Write: 50,000 assertions passed  607.77ms  82,267/s
  Total failed: 0 / 300,000  - Synopse cross platform variant PASSED  1.91s

 1.4. QDAC:
  - Read: 50,000 assertions passed  637.91ms  78,379/s
  - Access: 100,000 assertions passed  89.47ms  558,846/s
  - Write: 50,000 assertions passed  391.53ms  127,703/s
  Total failed: 0 / 200,000  - QDAC PASSED  1.12s


2. Big content

 2.1. Depth content:
  - Download files if necessary: no assertion  358us
  - Synopse read variant: 1 assertion passed  161.44ms  309,712/s  227 KB
  - Synopse read to BSON: 2 assertions passed  2.62ms  19,025,875/s  159 KB
  - Synopse cross platform: 1 assertion passed  3.85ms  12,960,082/s  300 KB
  Total failed: 0 / 4  - Depth content PASSED  174.67ms

 2.2. Table content:
  - Download files if necessary: no assertion  587us  14,017,035/s
  - Synopse parse: 1 assertion passed  2.67ms  3,077,815/s  1.2 MB
  - Synopse ORM loop: 41,135 assertions passed  6.25ms  1,316,320/s  1.2 MB
  - Synopse ORM list: 41,135 assertions passed  6.77ms  1,214,138/s  1016 KB
  - Synopse table direct: 41,135 assertions passed  19.66ms  418,463/s  1.2 MB
  - Synopse table variant: 41,135 assertions passed  99.07ms  83,037/s  1.2 MB
  - Synopse doc variant: 41,137 assertions passed  31.13ms  264,227/s  3.0 MB
  - Synopse late binding: 41,137 assertions passed  107.81ms  76,305/s  3.0 MB
  - Synopse cross ORM: 41,135 assertions passed  17.14ms  479,876/s  1.9 MB
  - Synopse cross direct: 41,135 assertions passed  19.59ms  419,937/s  1.9 MB
  - Synopse cross variant: 41,135 assertions passed  102.76ms  80,053/s  1.9 MB
  - Synopse to BSON: 2 assertions passed  10.64ms  772,923/s  1.0 MB
  - QDAC: 41,136 assertions passed  41.42ms  198,604/s  5.9 MB
  Total failed: 0 / 411,358  - Table content PASSED  491.91ms

 2.3. Huge content:
  - Download files if necessary: no assertion  499us
  - Synopse beautifier: 1 assertion passed  1.36s  36,554/s  395.5 MB
  - Synopse read record: 4 assertions passed  1.42s  144,924/s  113.5 MB
  - Synopse read variant: 2 assertions passed  3.25s  63,404/s  377.4 MB
  - Synopse cross platform: 2 assertions passed  5.35s  38,558/s  424.9 MB
  - Synopse read to BSON: 3 assertions passed  1.95s  105,727/s  168.1 MB
  - QDAC read: 2 assertions passed  8.28s  24,920/s  1.1 GB
  Total failed: 0 / 14  - Huge content PASSED  22.73s


Generated with: Delphi XE7 compiler

Time elapsed for all tests: 28.08s
Tests performed at 01/02/2015 13:46:04

Total assertions failed for all test suits:  0 / 1,411,376
! All tests passed successfully.

For small objects, it performs very well - but of course slower than mORMot code.
But for bigger content, it consumes a lot of memory.

For instance, when reading a table of data results as JSON array of objects:
- Our ORM code performs at 1,316,320 rows/s and uses 1.2 MB of RAM;
- QDAC achieves  198,604 row/s and uses 5.9 MB
That is 8 times slower, and using 5 times more memory.

Performance is similar under Win64:
- Our ORM code performs at 1,190,076 rows/s and uses 1.3 MB of RAM;
- QDAC achieves  178,607 row/s and uses 9.3 MB
That is 8 times slower, and using 7 times more memory.

We did not test QDACcross-platform abilities, nor its RTTI methods, which should be even slower.

But we found a very annoying implementation issue of the JSON standard.
We discovered that QDAC it is not able to parse "" as a key, whereas it is valid JSON key.
All other parsers do accept this sample.json reference content.
I hope they will fix this issue.

Offline

#2 2015-02-03 04:40:56

keinn
Member
Registered: 2014-10-20
Posts: 103

Re: Benchmarking QDAC3 JSON parser

im impressed by your great work .
is there any plan to extract json paser from mORMot framework?? so we can have this powerfull json lib?

btw:Author of QDAC already fix this .

Offline

#3 2015-02-03 07:00:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,662
Website

Re: Benchmarking QDAC3 JSON parser

Good news !
Thanks for the feedback.

The cross platform unit (i.e. SynCrossPlatformJSON.pas) is already stand alone.
It has pretty good performance, and the powerful TJSONVariant custom variant type.

The JSON SAX functions, and the TDocVariant type are defined in SynCommons.pas.
Full features (including TSQLTableJSON and object serialization) are in mORMot.pas.
You can use them without the ORM or SOA.
SynCommons+mORMot units compiles for Win32/Win64 and Linux with FPC or CrossKylix.
There would be no benefit of extracting the JSON process from mORMot.pas IMHO, for several reasons:
- due to compiler smart binding, the unused part (ORM or SOA) are not linked to the executable;
- the whole framework is JSON based, so having the JSON process part of the main framework unit is a great benefit (e.g. for using our optimized RTTI access, or for better handling of the ORM/SOA structures).

Offline

Board footer

Powered by FluxBB