Giter VIP home page Giter VIP logo

jackson-module-afterburner's Introduction

Module that will add dynamic bytecode generation for standard Jackson POJO serializers and deserializers, eliminating majority of remaining data binding overhead.

Plugs in using standard Module interface (requiring Jackson 2.0.0 or above).

For Javadocs, Download, see: Wiki.

Build Status

Status

At this point module should be considered experimental, but it does work for use cases I have tried so far; including jvm-serializers benchmark (where it helps Jackson data-bind get within 10-15% of "jackson/manual" performance; and 15-20 for Smile).

Current master branch works with Jackson 2.0.x:, and this is the actively developed version. Older builds (1.9.4) are still available, and source is under "1.x" branch, but no further development is planned for this version.

Usage

Maven dependency

To use module on Maven-based projects, use following dependency:

<dependency>
  <groupId>com.fasterxml.jackson.module</groupId>
  <artifactId>jackson-module-afterburner</artifactId>
  <version>2.1.1</version>
</dependency>

(or whatever version is most up-to-date at the moment)

Non-Maven

For non-Maven use cases, you download jars from Central Maven repository or Download page.

Databind jar is also a functional OSGi bundle, with proper import/export declarations, so it can be use on OSGi container as is.

Registering module

To use the the Module in Jackson, simply register it with the ObjectMapper instance:

ObjectMapper mapper = new ObjectMapper()
mapper.registerModule(new AfterburnerModule());

after which you just do data-binding as usual:

Value val = mapper.readValue(jsonSource, Value.class);
mapper.writeValue(new File("result.json"), val);

What is optimized?

Following things are optimized:

  • For serialization (POJOs to JSON):
  • Mutators for "setting" value (field access, calling setter method) are inlined using generated code instead of reflection
  • Serializers for small number of 'primitive' types (int, long, String) are replaced with direct calls, instead of getting delegated to JsonSerializers
  • For deserialization (JSON to POJOs)
  • Calls to default (no-argument) constructors are byte-generated instead of using reflection
  • Accessors for "getting" values (field access, calling setter method) are inlined using generated code instead of reflection
  • Deserializers for small number of 'primitive' types (int, long, String) are replaced with direct calls, instead of getting delegated to JsonDeserializers

More

Check out Wiki.

jackson-module-afterburner's People

Contributors

arturdryomov avatar chillenious avatar cowtowncoder avatar prb avatar tatu-at-salesforce avatar

Watchers

 avatar  avatar

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.