Skip to content

Commit 17bfb6f

Browse files
committed
run 5
1 parent d90d6a3 commit 17bfb6f

File tree

4 files changed

+437
-47
lines changed

4 files changed

+437
-47
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ build/
1111
/nbproject/
1212
out/
1313

14-
# System
14+
# Misc
1515
.DS_Store
16+
.swp
1617

1718
# Runtime
1819
*.json

README.md

Lines changed: 60 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
## Purpose
66

7-
The purpose of this project is to evaluate serialization and deserialization performance of JSON libraries in Java.
8-
The following libraries are evaluated:
7+
This project benchmarks the throughput performance of a variety of Java Json libraries using [JMH](http://openjdk.java.net/projects/code-tools/jmh/).
8+
It covers the following libraries:
99

1010
* [jackson](https://github.com/FasterXML/jackson)
1111
* [genson](https://owlike.github.io/genson/)
@@ -25,69 +25,84 @@ The following libraries are evaluated:
2525
* [moshi](https://github.com/square/moshi)
2626
* [tapestry](https://tapestry.apache.org/json.html)
2727
* [jsoniter](http://jsoniter.com)
28+
* [minimal-json](https://github.com/ralfstx/minimal-json)
2829

29-
This benchmark tests throughput performance of serialization and deserialization algorithms of the databind and stream API when available.
30-
Random payloads of various sizes are generated at runtime before each benchmark.
30+
When available, both databinding and 'stream' (custom packing and unpacking) implementations are tested.
31+
Two different kinds of [models](/src/main/java/com/github/fabienrenaud/jjb/model/) are evaluated with payloads of 1, 10, 100 and 1000 KB size:
32+
* [`Users`](/src/main/java/com/github/fabienrenaud/jjb/model/Users.java): uses primitive types, String, List and simple POJOs; and
33+
* [`Clients`](/src/main/java/com/github/fabienrenaud/jjb/model/Clients.java): adds arrays, enum, UUID, LocalDate
3134

32-
Four different sizes of payloads are evaluated in the charts below: 1 KB, 10 KB, 100 KB and 1 MB. And it is possible to generate on the fly any size of payloads.
35+
This benchmark is written to:
36+
* randomly generate payloads upon static loading of the JVM/benchmark; the *seed* is also shared across runs
37+
* read data from RAM
38+
* write data to reusable output streams (when possible); this reduces allocation pressure
39+
* consume all output streams; to avoid dead code elimination optimization
3340

34-
Each benchmark is written to read bytes from RAM and write to reusable output streams in RAM when possible, strings are rarely generated. All data is randomly generated upon static loading.
35-
36-
This benchmark does NOT evaluate:
37-
38-
* compression performance or efficiency
39-
* payloads bigger than 1.1 MB (would be easy to do though)
40-
* RAM utilization
41+
Not evaluated are: RAM utilization, compression, payloads > 1 MB.
4142

4243
## Results
4344

4445
The benchmarks are written with [JMH](http://openjdk.java.net/projects/code-tools/jmh/) and for Java 8.
4546

46-
The results here-below were computed on May the 21st, 2017 with the following libraries and versions:
47+
The results here-below were computed on April the 8th, 2018 with the following libraries and versions:
48+
49+
| Library | Version |
50+
|--------------|----------|
51+
| jackson | 2.9.5 |
52+
| genson | 1.4 |
53+
| fastjson | 1.2.47 |
54+
| gson | 2.8.2 |
55+
| org.json | 20090211 |
56+
| javax-json | 1.1.2 |
57+
| json-io | 4.10.0 |
58+
| flexjson | 3.3 |
59+
| boon | 0.34 |
60+
| json-smart | 2.3 |
61+
| johnzon | 1.1.1 |
62+
| logansquare | 1.3.7 |
63+
| dsl-json | 1.7.1 |
64+
| simplejson | 1.1.1 |
65+
| nanojson | 1.2 |
66+
| jodd json | 4.3.0 |
67+
| moshi | 1.5.0 |
68+
| tapestry | 5.4.3 |
69+
| jsoniter | 0.9.22 |
70+
| minimal-json | 0.9.5 |
71+
72+
[All graphs and sheets are available in this google doc.](https://docs.google.com/spreadsheets/d/1gI5-FFWwPjf4pxgYE0cEfbFIyNUGL8ci4NKLjTozU5I/edit?usp=sharing)
73+
74+
[Raw JMH results are available here][jmh-results]
75+
76+
### `Users` model
77+
78+
Uses: primitive types, String, List and simple POJOs
4779

48-
| Library | Version |
49-
|-------------|---------|
50-
| jackson | 2.9.4 |
51-
| genson | 1.4 |
52-
| fastjson | 1.2.32 |
53-
| gson | 2.8.2 |
54-
| org.json | 20090211 |
55-
| javax-json | 1.0, 1.0.4 |
56-
| json-io | 4.9.12 |
57-
| flexjson | 3.3 |
58-
| boon | 0.34 |
59-
| json-smart | 2.3 |
60-
| johnzon | 1.1.0 |
61-
| logansquare | 1.3.7 |
62-
| dsl-json | 1.7.0 |
63-
| simplejson | 1.1.1 |
64-
| nanojson | 1.2 |
65-
| jodd json | 3.8.5 |
66-
| moshi | 1.5.0 |
67-
| tapestry | 5.4.3 |
68-
| jsoniter | 0.9.11 |
80+
**Deserialization performance**
81+
![json deserialization performance for primitive types, String, List and simple POJOs](https://docs.google.com/spreadsheets/d/e/2PACX-1vR4_0Ew3t2-VeYUVgJM_VkELoVXSYJGWVUu7LWEEoLclY5TEYoZ8HsLnpTdcBGgjrGEGpvRnArjbKrv/pubchart?oid=1217359585&format=image)
6982

70-
[All graphs and sheets are available in this google doc.](https://docs.google.com/spreadsheets/d/16GSfiTSRP2WKu3XxqNPIW_0KvZ2PezjFMHqTHrG-XZU/edit?usp=sharing)
83+
**Serialization performance**
84+
![json serialization performance for primitive types, String, List and simple POJOs](https://docs.google.com/spreadsheets/d/e/2PACX-1vR4_0Ew3t2-VeYUVgJM_VkELoVXSYJGWVUu7LWEEoLclY5TEYoZ8HsLnpTdcBGgjrGEGpvRnArjbKrv/pubchart?oid=296776676&format=image)
7185

72-
### Deserialization performance
86+
### `Clients` model
7387

74-
![json deserialization performance](https://docs.google.com/spreadsheets/d/16GSfiTSRP2WKu3XxqNPIW_0KvZ2PezjFMHqTHrG-XZU/pubchart?oid=746064058&format=image)
88+
Uses: primitive types, String, List and simple POJOs, arrays, enum, UUID, LocalDate
7589

76-
[Raw JMH results here][jmh-results]
90+
Note: fewer libraries are tested with this model due to lack of support for some of the evaluated types.
7791

78-
### Serialization performance
92+
**Deserialization performance**
93+
![json deserialization performance for primitive types, String, List and simple POJOs, arrays, enum, UUID, LocalDate](https://docs.google.com/spreadsheets/d/e/2PACX-1vR4_0Ew3t2-VeYUVgJM_VkELoVXSYJGWVUu7LWEEoLclY5TEYoZ8HsLnpTdcBGgjrGEGpvRnArjbKrv/pubchart?oid=684555912&format=image)
7994

80-
![json serialization performance](https://docs.google.com/spreadsheets/d/16GSfiTSRP2WKu3XxqNPIW_0KvZ2PezjFMHqTHrG-XZU/pubchart?oid=1130150523&format=image)
95+
**Serialization performance**
96+
![json serialization performance for primitive types, String, List and simple POJOs, arrays, enum, UUID, LocalDate](https://docs.google.com/spreadsheets/d/e/2PACX-1vR4_0Ew3t2-VeYUVgJM_VkELoVXSYJGWVUu7LWEEoLclY5TEYoZ8HsLnpTdcBGgjrGEGpvRnArjbKrv/pubchart?oid=2004244401&format=image)
8197

82-
[Raw JMH results here][jmh-results]
8398

8499
### Benchmark configuration
85100

86101
#### JMH
87102

88-
# JMH version: 1.19
89-
# VM version: JDK 1.8.0_121, VM 25.121-b13
90-
# VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/bin/java
103+
# JMH version: 1.20
104+
# VM version: JDK 1.8.0_131, VM 25.131-b11
105+
# VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/bin/java
91106
# VM options: -XX:+AggressiveOpts -Xms2G -Xmx2G
92107
# Warmup: 5 iterations, 1 s each
93108
# Measurement: 10 iterations, 3 s each
@@ -141,4 +156,4 @@ find numerous examples in the commit history. For instance:
141156

142157
Pull requests are welcome.
143158

144-
[jmh-results]: /archive/raw-results-2017-05-21.md
159+
[jmh-results]: /archive/raw-results-2018-04-08.md

0 commit comments

Comments
 (0)