Skip to content

avurro/java-object-mapper-benchmark

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Object-to-object mapping framework microbenchmark

Multi-layered applications often require to map between different object models (e.g. DTOs and entities). Writing such boiler plate mapping code is a tedious and error-prone task. A lot of object-to-object mapping Java frameworks aims to simplify this work and automate it. Some uses code instrospection (eg. Dozer). Other uses code generation (ex: MapStuct). This micro-benchmark compares performance of 5 frameworks. Results could be compared to the benchmark of a code written manually.

Benchmark are powered by a tool called JMH or also known as "Java Microbenchmarking Harness". JMH is developed by the OpenJDK team.

Benchmarked object to object mapper frameworks

Contributing to benchmark

Github is for social coding platform: if you want to add another mapping framework or optimize an existing one, we encourage contributions through pull requests from forks of this repository. If you want to contribute code this way, please reference a GitHub ticket as well covering the specific issue you are addressing.

Data model

The data model used by this benchmark is very basic. It comes from the Comparison class from the ModelMapper framework. It includes combinations which usually appear in Java Beans, such as:

  • Object types
  • Collections

Data model UML diagram

Launch the benchmark

Pre-requisites: Maven 3.x and a JDK 6 (or above)

git clone git://github.com/arey/java-object-mapper-benchmark.git

mvn clean install

java -jar target/benchmarks.jar

Results

Tests has been performed on:

  • OS: MacOSX
  • CPU: Core i7 2.8GHz 6MB cache × 4 cores
  • RAM: 16GB
  • JVM: Oracle 1.8.0_25 64 bits
BenchmarkModeSamplesScoreMargin error (+/-)Units
Manualthrpt20017 277 097146 095ops/s
Selmathrpt20017 132 97938 209ops/s
MapStructthrpt20014 493 14467 522ops/s
Orikathrpt2003 283 55716 706ops/s
ModelMaperthrpt200282 0392 176ops/s
Dozerthrpt200103 0061 362ops/s

Legend : Higher score is better

Total time: 00:49:06

Documentation

Credits

  • Uses Maven as a build tool
  • Uses JMH for Java Microbenchmarking Harness

About

JMH benchmark of Java object-to-object mapping frameworks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%