android - Jackson JSON Parser performance -


To make much better performance than the GSOn on the internet point of the Internet point of Jackson, to provide anywhere in the neighborhood of 20-30%

  • P> For example, I'm not replacing my ObjectMapper , and I want to read all JSON Using the ObjectReader . Here are some sample codes:
      Public class JasonPerser {@nolal Private Final ObjectMaper objectMapper; Public JsonParser () {Final ObjectMapper objectMapper = New ObjectMapper (); ObjectMapper.setDateFormat (DateFormatUtil.getGmtIso8601DateFormat ()); Simple Module Simple Module = New Simple Module (); objectMapper.registerModule (simpleModule); This.objectMapper = objectMapper; } Public & lt; T & gt; Takes Jason (InputStream inputstream, class & lieutenant; T & gt; clues) throws IOException (Object reader reader = ObjectMaper. Reader (clause); Return Reader Read value (input stream); }}   

    The above object is created once and it is used to translate JSON into POJO for the duration of the app. A sample POJO can be seen here:

      @JasonSerialize (Include = Insertions.NON_NULL) @JasonIgnorproporties (UndiscoveredAgain = True) Public-Class ActivityAnty {Public Activity Object Actor; Public activity object object; Public Activity Object Entity Provider; Public activity object target goal; Public activity object differential generator; Public string content; Public string title; Public string action; Public string url; Public date published; Public date update; // Other properties omitted ...}   

    What is being serial is actually a list of the above items.

    Here's my sample trace view window with every run. Note, it is not an embarrassment not I get the same sequence of the same performance from both GSO and Jackson to parse the same dataset.

    The comparison was with Jackson 2.4.2 and GS 2.2.4

    Traceview output from Jackson Output from Traceview GSOON

    The code looks correct, and in its worst case, should not be slower than Jackson; And certainly not by the multiples of some

    If you were able to obtain a profiler snapshot for the call stack (to continue continuous for 10+ seconds), then it probably would tell how extra time has passed, and the culprit Can help understand.

    I will still double check that JsonParser has not been created unknowingly many times: a difficult case for example Jersey (DropWizard directly or through) which is often Can create resources, unless asked to create and use singleton examples. I say this because the symptoms fit just this matter properly, not because I suspect you have not done enough work.

  • Comments

    Popular posts from this blog

    php - PDO bindParam() fatal error -

    logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

    java - Why my included JSP file won't get processed correctly? -