Giter Site home page Giter Site logo

java-object-mapper-benchmark's Introduction

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 6 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: OS X El Capitan
  • CPU: 3.1 GHz Intel Core i7, 2 cores, L2 Cache (per Core): 256 KB, L3 Cache: 4 MB
  • RAM: 16 GB 1867 MHz DDR3
  • JVM: Oracle 1.8.0_102 64 bits
BenchmarkModeSamplesScoreMargin error (+/-)Units
Manualthrpt20016 449 06553 680ops/s
Selmathrpt20015 806 33741 094ops/s
MapStructthrpt20014 237 19451 179ops/s
JMapperthrpt20013 960 30058 236ops/s
Orikathrpt2003 014 11314 411ops/s
ModelMaperthrpt200246 3652 019ops/s
Dozerthrpt20078 140349ops/s

Legend : Higher score is better

Total time: 00:48:33

Documentation

Credits

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.