2 Replies Latest reply: Feb 27, 2014 3:18 PM by rp0428 RSS

    Orika vs JMapper - how it works and a speed difference - why ?



      I have downloaded and testing these two mapping libraries. I wrote a program which has 100000 iterations and maps the beans of the same class:

      public class IntBean {



          private int int1;


          private int int2;

          @JMap private int int3;

          @JMap private int int4;

          @JMap private int int5;

          @JMap private int int6;

          @JMap private int int7;

          @JMap private int int8;

          @JMap private int int9;

          @JMap private int int10;




      Mappers are created BEFORE iterations start:


          private JMapper jmapper = new JMapper(IntBean.class, IntBean.class);

          private MapperFactory orikaFactory = new DefaultMapperFactory.Builder().build();

          private MapperFacade orikaFacade = null;

          orikaFacade = orikaFactory.getMapperFacade();


      What is in each iteration:
      this.orikaFacade.map(a1, a2);


      a2 =  (A) this.jmapper2.getDestination(a1);



      I know, that Orika and Jmapper are great libraries from Google and they use reflection in a different way than for example Dozer, which is much slower, they se reflection to generete code somehow..

      I have 3 questions:
      1) How they work - when the code is generated, during maven build, in runtime - everytime when I create mapper in code? Are they change class code byte dynamically?

      2) Why there is this speed difference that I noticed?

      3) Which library would you choose and why? Both have the same capabilities? Why both come from Google? Why Google didnt develop Orika and created Jmapper instead?