Skip to content

wizzardo/json-benchmarks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON serialization benchmarks

Methodology

Participants:

For testing were selected data with different structure:

  • citys - A large array (29470 items) of simple objects. The compact json representation takes about 2.5 MB. Main challenge: floating point numbers
  • repos.json - An array of four objects with complex structure. The compact json representation takes about 342.8 kB. Main challenge: a lot of String fields
  • user.json - one object with a complex structure. The compact json representation takes about 4.2 kB. Main challenge: dates
  • request.json - one object with a simple structure. The compact json representation takes about 425 B. Main challenge: Maps of Strings, small json

Serialization and deserialization were tested with POJO and Map-like structures

Build and Run

./gradlew clean && ./gradlew shadowJar && java -jar build/libs/json-benchmarks-all.jar ".*Benchmarks.*"
# or individual benchmarks
./gradlew clean && ./gradlew shadowJar && java -jar build/libs/json-benchmarks-all.jar ".(Des|S)erializationBenchmarks.(pojo|map)_(dslplatform|tools|kotlinx|jsonIterator|klaxon).*"  

serializationbenchmarks user serializationbenchmarks citys serializationbenchmarks repos serializationbenchmarks request deserializationbenchmarks user deserializationbenchmarks citys deserializationbenchmarks repos deserializationbenchmarks request

Checking performance of Boon

Very different results for boon deserialization into maps and pojos looked suspicious for me, so I've made another benchmark: 'deserialize into map' vs 'deserialize into map and get value of one field' and compared it with Tools and pojos.

As I expected, Boon uses lazy maps and creates actual values only when requested

deserializationboonbenchmarks

About

Benchmarks for popular json libraries

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 82.9%
  • Kotlin 17.1%