Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6680711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:30:25+00:00 2026-05-26T04:30:25+00:00

After searched in google, found that jackson has better performance than gson, i plan

  • 0

After searched in google, found that jackson has better performance than gson, i plan to replace gson with jackson in my project, but i got a diffrent result when run test code.

private static final Type PHOTOLINKS_TYPE_GSON = new TypeToken<List<Photo>>() {}.getType();
private static final Type PHOTOCAPTIONS_TYPE_GSON = new TypeToken<List<String>>() {}.getType();
Gson gson = new Gson();
private void testGson(String photoJson, String captionJson) {
    GSON_MON.start();
    List<Photo> photos = gson.fromJson(photoJson, PHOTOLINKS_TYPE_GSON);
    List<String> photoCaptions = gson.fromJson(captionJson, PHOTOCAPTIONS_TYPE_GSON);
    GSON_MON.stop();
}

TypeReference<List<Photo>> PHOTOLINKS_TYPE_JACKSON = new TypeReference<List<Photo>>(){};
TypeReference<List<String>> PHOTOCAPTIONS_TYPE_JACKSON = new TypeReference<List<String>>(){};
ObjectMapper mapper = new ObjectMapper();
private void testJackson(String photoJson, String captionJson) {
    JACKSON_MON.start();
    try {
        List<Photo> photos = mapper.readValue(photoJson, PHOTOLINKS_TYPE_JACKSON);
        List<String> photoCaptions = mapper.readValue(captionJson, PHOTOCAPTIONS_TYPE_JACKSON);
    } catch (JsonParseException e) {
        e.printStackTrace();
    } catch (JsonMappingException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    JACKSON_MON.stop();
}

Photo is a normal class:

@JsonIgnoreProperties(ignoreUnknown = true)
private static class Photo implements Serializable {
private static final long serialVersionUID = 5645393489907650496L;

public String small;
public String middle;
public String orign;
public String caption;
public String ow;
public String oh;
}

and the photo json is something like:
[{“id”:”1318403074887″,”orign”:”xxx.jpg”,”ow”:427,”small”:”xxx.jpg”,”middle”:”xxx.jpg”,”oh”:640},{“id”:”1318403076793″,”orign”:”xxx.jpg”,”ow”:640,”small”:”xxx.jpg”,”middle”:”xxx.jpg”,”oh”:480},{“id”:”1318403092168″,”orign”:”xxx.jpg”,”ow”:425,”small”:”xxx.jpg”,”middle”:”xxx.jpg”,”oh”:640}]

i use JAMon to moniter the perfomance, below is the result:

  • JAMon Label=jackson, Units=ms.: (LastValue=18.0, Hits=30.0, Avg=18.4, Total=552.0, Min=13.0, Max=37.0, Active=0.0, Avg Active=1.0, Max Active=1.0)
  • JAMon Label=gson, Units=ms.: (LastValue=4.0, Hits=30.0, Avg=2.1666666666666665, Total=65.0, Min=0.0, Max=4.0, Active=0.0, Avg Active=1.0, Max Active=1.0)
  • JAMon Label=jackson, Units=ms.: (LastValue=20.0, Hits=30.0, Avg=15.166666666666666, Total=455.0, Min=12.0, Max=25.0, Active=0.0, Avg Active=1.0, Max Active=1.0)
  • JAMon Label=gson, Units=ms.: (LastValue=4.0, Hits=30.0, Avg=2.2, Total=66.0, Min=0.0, Max=9.0, Active=0.0, Avg Active=1.0, Max Active=1.0)
  • JAMon Label=jackson, Units=ms.: (LastValue=19.0, Hits=30.0, Avg=16.433333333333334, Total=493.0, Min=11.0, Max=51.0, Active=0.0, Avg Active=1.0, Max Active=1.0)
  • JAMon Label=gson, Units=ms.: (LastValue=2.0, Hits=30.0, Avg=1.9, Total=57.0, Min=0.0, Max=6.0, Active=0.0, Avg Active=1.0, Max Active=1.0)

it seems gson is more faster than jackson, the average time of gson is about 2ms while jackson is about 16ms, does i make mistake when using jackson?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:30:26+00:00Added an answer on May 26, 2026 at 4:30 am

    It may be simple issue with performance monitoring: looks like you are not “warming up” JVM by running tests for long enough to let it compile byte code and so on. Typically tests need to be run at least for 5 – 10 seconds before taking measurements.

    So perhaps try doing that first, see how numbers change. I bet numbers for both will increase — it should take a fraction of a millisecond for small objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched through Google, SO and Android developers but I need some further
I've searched around for answers to this question, but not found anything quite on
Update, Solved: After all this I found out that I was calling an old
I have searched Google for the standalone Hibernate/Spring applications, but didn't find any useful
I have what I know is a simple question, but after many searches in
After being told by at least 10 people on SO that version control was
After lots of attempts and search I have never found a satisfactory way to
After hours of debugging, it appears to me that in FireFox, the innerHTML of
I'm new here, just found these forums on Google. First of all, I want
I'm using http://benalman.com/projects/jquery-hashchange-plugin/ to listen for hash changes in my project, but his plugin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.