Is it worth it, serialized pojo or straight json?

I am trying to squeeze out the last little bit of performance from a backend pipeline application. I am storing rules in Couchbase. These rules are simple POJOs with mostly name value pairs serialized with GSON to store in couchbase.

I query a view and get a response with rows.

if (response != null{ for (ViewRow row : response) { DOC_RuleDefinition drd = new DOC_RuleDefinition(); drd = gson.fromJson((String) row.getDocument(), DOC_RuleDefinition.class); ruleDefinitions.add(drd); } } This works just fine, but it costs me 10-20ms each time. Is it worth it? Is there a faster way? I mean is there a way to skip the instantiation and population of the pojo and just get the values directly from the json string?

MO

Try use Jackson instead of GSON. Jackson is the fastest java library to process json documents.

1 Like

Hello,

Has vakoroteev mentionned you can try with other JSON library such has Jackson or JSON Smart: http://json.org/

Regards
Tug
@tgrall