| # Java Xlang Serialization Benchmarks |
| |
| See the [Java JSON benchmark report](../../../json/java/README.md) for fory-json, Jackson, and Gson results. |
| |
| This report covers the xlang benchmark groups generated by |
| `benchmarks/java/run.sh`. It does not inherit the environment or native-mode |
| workloads recorded in the separate [Java native report](../../native/java/README.md). |
| The checked-in xlang snapshot did not record its host, Fory commit, or dependency |
| versions; rerun the benchmark before using these results for a current comparison. |
| |
| See [Benchmark Methodology](../../../methodology.md) for the metadata required by |
| new or refreshed reports. |
| |
| ## Workloads |
| |
| - `NumericStruct`: primitive numeric fields. |
| - `Sample`: the model used by the [Kryo benchmark suite](https://github.com/EsotericSoftware/kryo/blob/master/benchmarks/src/main/java/com/esotericsoftware/kryo/benchmarks/data/Sample.java). |
| - `MediaContent`: the media model from [jvm-serializers](https://github.com/eishay/jvm-serializers/blob/master/tpc/src/data/media/MediaContent.java). |
| - `*List`: a list of the corresponding model. |
| |
| ## Run the Benchmark |
| |
| Run from `benchmarks/java/run.sh`. Raw JMH JSON stays under the ignored local |
| `benchmarks/java/reports/` directory; `throughput.png` and this xlang report are |
| published under `docs/benchmarks/object-serialization/xlang/java/`. |
| |
| ```bash |
| cd benchmarks/java |
| ./run.sh |
| ``` |
| |
| JMH parameters: `-f 1 -wi 3 -i 3 -t 1 -w 3s -r 3s -bm thrpt -tu s`. Do not |
| skip warmup. Higher throughput is better. |
| |
| ## Results |
| |
|  |
| |
| | Data type | Operation | Fory ops/sec | Protobuf ops/sec | Flatbuffer ops/sec | Fastest | |
| | ----------------- | ----------- | ------------ | ---------------- | ------------------ | ------- | |
| | NumericStruct | Serialize | 46,787,647 | 33,024,161 | 9,612,018 | Fory | |
| | NumericStruct | Deserialize | 71,683,707 | 29,837,931 | 40,514,436 | Fory | |
| | Sample | Serialize | 17,406,902 | 2,071,963 | 3,153,672 | Fory | |
| | Sample | Deserialize | 17,772,123 | 1,867,967 | 4,179,494 | Fory | |
| | MediaContent | Serialize | 10,783,325 | 1,781,338 | 1,444,737 | Fory | |
| | MediaContent | Deserialize | 7,950,203 | 2,184,597 | 3,453,985 | Fory | |
| | NumericStructList | Serialize | 21,263,673 | 2,511,081 | 3,047,836 | Fory | |
| | NumericStructList | Deserialize | 19,249,877 | 2,067,204 | 8,168,569 | Fory | |
| | SampleList | Serialize | 4,580,165 | 401,280 | 696,268 | Fory | |
| | SampleList | Deserialize | 3,811,985 | 344,945 | 773,625 | Fory | |
| | MediaContentList | Serialize | 1,657,717 | 353,717 | 296,868 | Fory | |
| | MediaContentList | Deserialize | 1,111,043 | 435,956 | 516,192 | Fory | |