@@ -108,37 +108,43 @@ Results as reported on console, except sorted in descending order of performance
108108```
109109% java -Xmx256m -jar target/microbenchmarks.jar ".*DZoneWrite.*write1k.*AsString.*" -wi 4 -i 5 -f 19
110110
111- # Run complete. Total time: 00:20:58
111+ # Run complete. Total time: 00:29:51
112112
113113Benchmark Mode Cnt Score Error Units
114- DZoneWriteJackson.write1kAsString thrpt 95 4377.870 ± 22.375 ops/s
115- DZoneWriteJacksonJr.write1kAsString thrpt 95 3880.734 ± 32.488 ops/s
116- DZoneWriteBoon.write1kAsString thrpt 95 2614.780 ± 15.105 ops/s
117- DZoneWriteJohnzon.write1kAsString thrpt 95 2088.878 ± 12.612 ops/s
118- DZoneWriteMoshi.write1kAsString thrpt 95 1655.735 ± 9.793 ops/s
119- DZoneWriteGSON.write1kAsString thrpt 95 1209.408 ± 10.565 ops/s
120- DZoneWriteJsonIO.write1kAsString thrpt 95 883.185 ± 7.002 ops/s
114+ DZoneWriteDslJson.write1kAsString thrpt 95 6222.612 ± 49.992 ops/s
115+ DZoneWriteFastjson.write1kAsString thrpt 95 4256.503 ± 21.408 ops/s
116+ DZoneWriteJacksonAB.write1kAsString thrpt 95 3898.636 ± 33.145 ops/s
117+ DZoneWriteJackson.write1kAsString thrpt 95 3386.443 ± 66.570 ops/s
118+ DZoneWriteJacksonJr.write1kAsString thrpt 95 3182.897 ± 29.049 ops/s
119+ DZoneWriteBoon.write1kAsString thrpt 95 2300.457 ± 59.546 ops/s
120+ DZoneWriteJohnzon.write1kAsString thrpt 95 1528.370 ± 24.255 ops/s
121+ DZoneWriteMoshi.write1kAsString thrpt 95 1437.739 ± 22.236 ops/s
122+ DZoneWriteGSON.write1kAsString thrpt 95 1057.819 ± 10.063 ops/s
123+ DZoneWriteJsonIO.write1kAsString thrpt 95 671.863 ± 14.453 ops/s
121124```
122125
123- Given that the test measures throughput, Jackson (the fastest) is about 5x as fast as json.io (the slowest) for this test.
126+ Given that the test measures throughput, DSL-JSON (the fastest) is about 10x as fast as json.io (the slowest) for this test.
124127
125- #### Reading 1000 item (POJO) list from String
128+ #### Reading 10 item (POJO) list from String
126129
127130```
128131% java -Xmx256m -jar target/microbenchmarks.jar ".*DZoneReadPojo.*read10FromString.*" -wi 4 -i 5 -f 9
129132
130- # Run complete. Total time: 00:10:27
133+ # Run complete. Total time: 00:13:52
131134
132135Benchmark Mode Cnt Score Error Units
133- DZoneReadPojoJacksonJr.read10FromString thrpt 45 217944.421 ± 3606.032 ops/s
134- DZoneReadPojoJackson.read10FromString thrpt 45 215162.661 ± 3699.385 ops/s
135- DZoneReadPojoGSON.read10FromString thrpt 45 143185.788 ± 3431.425 ops/s
136- DZoneReadPojoBoon.read10FromString thrpt 45 118542.144 ± 1747.026 ops/s
137- DZoneReadPojoMoshi.read10FromString thrpt 45 92379.201 ± 1415.529 ops/s
138- DZoneReadPojoJohnzon.read10FromString thrpt 45 74268.988 ± 1505.027 ops/s
136+ DZoneReadPojoDslJson.read10FromString thrpt 45 233152.796 ± 2513.390 ops/s
137+ DZoneReadPojoJacksonAB.read10FromString thrpt 45 188005.499 ± 5640.662 ops/s
138+ DZoneReadPojoJacksonJr.read10FromString thrpt 45 176081.143 ± 3220.812 ops/s
139+ DZoneReadPojoJackson.read10FromString thrpt 45 171522.616 ± 1614.882 ops/s
140+ DZoneReadPojoFastjson.read10FromString thrpt 45 165517.191 ± 2058.242 ops/s
141+ DZoneReadPojoGSON.read10FromString thrpt 45 126607.540 ± 4538.410 ops/s
142+ DZoneReadPojoBoon.read10FromString thrpt 45 92211.900 ± 596.884 ops/s
143+ DZoneReadPojoJohnzon.read10FromString thrpt 45 70438.271 ± 865.507 ops/s
144+ DZoneReadPojoMoshi.read10FromString thrpt 45 73756.350 ± 932.405 ops/s
139145```
140146
141- And in this case, Jackson is 50% faster than GSON, twice as fast as Moshi and triple Johnzon speed.
147+ And in this case, DSL-JSON is 20% faster than Jackson which is 50% faster than GSON, twice as fast as Boon and triple Johnzon speed.
142148
143149Json-io is not (yet) included because it seems to require JSON content to be specifically written by ` json-io `
144150itself, and not accept standard json representation (probably since it requires type information embedded).
@@ -148,20 +154,67 @@ itself, and not accept standard json representation (probably since it requires
148154```
149155% java -Xmx256m -jar target/microbenchmarks.jar ".*DZoneReadMap.*read10FromString.*" -wi 4 -i 5 -f 9
150156
151- # Run complete. Total time: 00:10:26
157+ # Run complete. Total time: 00:15:16
152158
153159Benchmark Mode Cnt Score Error Units
154- DZoneReadMapJacksonJr.read10FromString thrpt 45 233240.208 ± 2844.701 ops/s
155- DZoneReadMapBoon.read10FromString thrpt 45 216714.713 ± 2328.799 ops/s
156- DZoneReadMapJackson.read10FromString thrpt 45 197597.668 ± 2092.722 ops/s
157- DZoneReadMapGSON.read10FromString thrpt 45 154916.876 ± 1355.639 ops/s
158- DZoneReadMapJohnzon.read10FromString thrpt 45 75610.515 ± 469.744 ops/s
159- DZoneReadMapJsonIO.read10FromString thrpt 45 28445.343 ± 279.304 ops/s
160- DZoneReadMapJsonMoshi.read10FromString thrpt 45 86168.309 ± 1428.668 ops/s
160+ DZoneReadMapJacksonJr.read10FromString thrpt 45 183788.845 ± 1926.758 ops/s
161+ DZoneReadMapFastjson.read10FromString thrpt 45 172123.796 ± 1628.945 ops/s
162+ DZoneReadMapJackson.read10FromString thrpt 45 169171.957 ± 1678.742 ops/s
163+ DZoneReadMapBoon.read10FromString thrpt 45 151415.861 ± 1471.262 ops/s
164+ DZoneReadMapDslJson.read10FromString thrpt 45 144000.109 ± 2528.670 ops/s
165+ DZoneReadMapGSON.read10FromString thrpt 45 136533.317 ± 5371.167 ops/s
166+ DZoneReadMapJsonMoshi.read10FromString thrpt 45 72646.224 ± 738.465 ops/s
167+ DZoneReadMapJsonParse.read10FromString thrpt 45 65851.568 ± 356.922 ops/s
168+ DZoneReadMapJohnzon.read10FromString thrpt 45 64726.343 ± 355.917 ops/s
169+ DZoneReadMapJsonIO.read10FromString thrpt 45 29088.020 ± 625.932 ops/s
161170```
162171
163- In this test, ` Boon ` has performance slightly exceeding standard Jackson (and only slightly
164- below ` jackson-jr ` ); GSON coming in relatively close, and other options being significantly
172+ In this test, ` Fastjson ` has performance slightly exceeding standard Jackson (and only slightly
173+ below ` jackson-jr ` ); GSON and Boon coming in relatively close, and other options being significantly
165174slower.
166175
167176Boon seems to specifically optimized for the combination of "untyped" (Lists, Maps) result, and use of ` String ` as input. In fact, with bigger input size, ` Boon ` is the fastest library.
177+
178+ #### Writing 1000 item (POJO) list to Stream
179+
180+ ```
181+ % java -Xmx256m -jar target/microbenchmarks.jar ".*DZoneWrite.*write1kUsingStream" -wi 4 -i 5 -f 9
182+
183+ # Run complete. Total time: 00:14:09
184+
185+ Benchmark Mode Cnt Score Error Units
186+ DZoneWriteDslJson.write1kUsingStream thrpt 45 11059.275 ± 71.957 ops/s
187+ DZoneWriteJacksonAB.write1kUsingStream thrpt 45 4839.274 ± 58.191 ops/s
188+ DZoneWriteJackson.write1kUsingStream thrpt 45 3943.914 ± 56.247 ops/s
189+ DZoneWriteFastjson.write1kUsingStream thrpt 45 3619.340 ± 23.558 ops/s
190+ DZoneWriteJacksonJr.write1kUsingStream thrpt 45 3500.094 ± 114.309 ops/s
191+ DZoneWriteBoon.write1kUsingStream thrpt 45 1985.888 ± 75.288 ops/s
192+ DZoneWriteJohnzon.write1kUsingStream thrpt 45 1602.113 ± 18.489 ops/s
193+ DZoneWriteMoshi.write1kUsingStream thrpt 45 1282.247 ± 24.045 ops/s
194+ DZoneWriteJsonIO.write1kUsingStream thrpt 45 813.591 ± 23.716 ops/s
195+ DZoneWriteGSON.write1kUsingStream thrpt 45 542.166 ± 14.094 ops/s
196+ ```
197+
198+ DSL-JSON is much faster when using Stream instead of String. Up to 20x difference than GSON.
199+
200+
201+ #### Read 1000 item (POJO) list from Stream
202+
203+ ```
204+ % java -Xmx256m -jar target/microbenchmarks.jar ".*DZoneReadPojo.*read1kFromStream.*” -wi 4 -i 5 -f 9
205+
206+ # Run complete. Total time: 00:13:51
207+
208+ Benchmark Mode Cnt Score Error Units
209+ DZoneReadPojoDslJson.read1kFromStream thrpt 45 3054.305 ± 92.445 ops/s
210+ DZoneReadPojoJacksonAB.read1kFromStream thrpt 45 2449.244 ± 40.747 ops/s
211+ DZoneReadPojoJacksonJr.read1kFromStream thrpt 45 1982.046 ± 16.049 ops/s
212+ DZoneReadPojoJackson.read1kFromStream thrpt 45 1955.585 ± 22.946 ops/s
213+ DZoneReadPojoFastjson.read1kFromStream thrpt 45 1450.955 ± 9.774 ops/s
214+ DZoneReadPojoBoon.read1kFromStream thrpt 45 1300.449 ± 81.215 ops/s
215+ DZoneReadPojoGSON.read1kFromStream thrpt 45 1176.733 ± 14.119 ops/s
216+ DZoneReadPojoJohnzon.read1kFromStream thrpt 45 651.262 ± 41.751 ops/s
217+ DZoneReadPojoMoshi.read1kFromStream thrpt 45 639.329 ± 22.281 ops/s
218+ ```
219+
220+ DSL-JSON is around 20% faster than Jackson and 5x faster then slowest (Moshi) which doesn’t support Stream input.
0 commit comments