1
- json_benchmark
1
+ JSON Benchmark
2
2
==============
3
3
4
4
Simple benchmark for a number of C++ JSON libraries.
@@ -42,35 +42,59 @@ There are two sets of JSON test data:
42
42
* ``` data/one-json-per-line.jsons ``` collection of 500 sample JSON strings from sub-100 to 500 characters long.
43
43
44
44
45
- Note, all libraries are used to read and parse strings of narrow ``` char ```
45
+ Important notes:
46
+ * All timings obtained running optimised builds of the binaries.
47
+ * All libraries are used to read and parse strings of narrow ``` char ```
46
48
characters (i.e. ``` std::string ``` ), no ``` wchar_t ``` strings are used.
49
+ * rapidjson was used in DOM parsing mode, not SAX
50
+ * libjson supports lazy parsing, times collected for this modes was:
51
+ ```
52
+ libjson.small: 1000 iterations of 500 parsings in 0.478065 to 0.486636 sec based on 2 benchmarks
53
+ ```
47
54
48
- All timings obtained running optimised builds of the binaries.
49
-
50
- Visual C++ 11.0
51
- ---------------
55
+ GCC 4.7 (64-bit build)
56
+ ----------------------
52
57
58
+ HW: Intel(R) Xeon(R) CPU E5-2630L 0 @ 2.00GHz, 2 GB RAM
59
+ OS: Linux 64-bit (Debian 7)
60
+
53
61
* small
54
62
55
63
```
56
- rapidjson.small: 2 marks of 1000 x 500 batch of parsings in 0.961858 to 0.962361 per batch
57
- libjson.small: 2 marks of 1000 x 500 batch of parsings in 5.2787 to 5.29663 per batch
58
- jsoncpp.small: 2 marks of 1000 x 500 batch of parsings in 5.762 to 5.77978 per batch
59
- casablanca.small: 2 marks of 1000 x 500 batch of parsings in 17.7374 to 17.7587 per batch
60
- spirit.small: 2 marks of 1000 x 500 batch of parsings in 22.137 to 22.137 per batch
64
+ rapidjson.small: 1000 iterations of 500 parsings in 1.08639 to 1.08639 sec based on 2 benchmarks
65
+ jsoncpp.small: 1000 iterations of 500 parsings in 18.5563 to 19.6208 sec based on 2 benchmarks
66
+ spirit.small: 1000 iterations of 500 parsings in 27.4479 to 27.4479 sec based on 2 benchmarks
61
67
```
68
+
62
69
* large
63
70
64
71
```
65
- rapidjson.large: 2 marks of 1000 x 1 batch of parsings in 7.96621 to 7.97555 sec per batch
66
- libjson.large: 2 marks of 1000 x 1 batch of parsings in 240.289 to 240.289 sec per batch
72
+ rapidjson.large: 1000 iterations of 1 parsings in 13.8156 to 14.2241 sec based on 2 benchmarks
73
+ jsoncpp.large: 1000 iterations of 1 parsings in 376.313 to 384.015 sec based on 2 benchmarks
74
+ spirit.large: 1000 iterations of 1 parsings in 988.167 to 995.634 sec based on 2 benchmarks
67
75
```
68
76
69
- Notes:
70
- * rapidjson was used in DOM parsing mode, not SAX
71
- * libjson supports lazy parsing, times collected for this modes was:
77
+ Visual C++ 11.0 (32-bit build)
78
+ ------------------------------
79
+
80
+ HW: Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz, 16 GB RAM
81
+ OS: Windows 7 64-bit
82
+
83
+ * small
84
+
85
+ ```
86
+ rapidjson.small: 1000 iterations of 500 parsings in 0.961858 to 0.962361 sec based on 2 benchmarks
87
+ libjson.small: 1000 iterations of 500 parsings in 5.2787 to 5.29663 sec based on 2 benchmarks
88
+ jsoncpp.small: 1000 iterations of 500 parsings in 5.762 to 5.77978 sec based on 2 benchmarks
89
+ casablanca.small: 1000 iterations of 500 parsings in 17.7374 to 17.7587 sec based on 2 benchmarks
90
+ spirit.small: 1000 iterations of 500 parsings in 22.137 to 22.137 sec based on 2 benchmarks
91
+ ```
92
+
93
+ * large
94
+
72
95
```
73
- libjson.small: 2 marks of 1000 x 500 batch of parsings in 0.478065 to 0.486636 per batch
96
+ rapidjson.large: 1000 iterations of 1 parsings in 7.96621 to 7.97555 sec based on 2 benchmarks
97
+ libjson.large: 1000 iterations of 1 parsings in 240.289 to 240.289 sec based on 2 benchmarks
74
98
```
75
99
76
100
JSON Writing
@@ -96,7 +120,9 @@ Alternatively, set the environment variables:
96
120
97
121
The environment variables can be passed directly on the Boost.Build invocation:
98
122
```
99
- b2 -sBOOST_ROOT=/home/mloskot/boost/trunk -sJSON_SPIRIT_ROOT=/home/mloskot/json_spirit
123
+ b2 -sBOOST_ROOT=/home/mloskot/boost/trunk \
124
+ -sJSON_SPIRIT_ROOT=/home/mloskot/json_spirit \
125
+ -sRAPIDJSON_ROOT=/home/mloskot/rapidjson
100
126
```
101
127
and so on.
102
128
0 commit comments