Recently I wanted find a POJO to JSON mapper and finally ended up using Jackson because it is recommended in most places, but when I just did a small test I found out that to serialize java object which is even having 2 attributes it takes average time of 450ms
but if I do the mapping manually it takes only less than 10ms , below is my simple code for calculating the time.
public static void main(String[] args) throws Exception{
long time = new Date().getTime();
User user = new User();
user.set_id("100");
user.setName("testuser");
ObjectMapper mapper = new ObjectMapper();
StringWriter write = new StringWriter();
mapper.writeValue(write, user);
long endtime = new Date().getTime();
System.out.println("Spent Time : "+(endtime-time));
}
So my question is should I still use Jackon? is any other benefits that I have not understood. for your note project that I'm currently working is having spring and mongodb and our task is to develop REST Service, and we don't want a particular request to hang unwanted time.