Skip to main content

Best Practices

  • Reuse instances of serializers and parsers whenever possible.
    They are designed to be thread safe and maintain internal caches of bean metadata to increase performance.

  • The BeanTraverseContext.Builder.detectRecursions() option can cause a performance penalty of around 20%. Therefore, it's recommended that this option be used only when necessary.

  • In general, JSON serialization and parsing is about 20% faster than XML. JSON is also more compact than XML. MessagePack is fastest and most compact of all.

  • The RDF parsers are SLOW. RDF simply isn't efficient with node traversal, so creating tree structures out of RDF models is highly inefficient.

  • The Parser methods that take in ClassMeta parameters are slightly faster than methods that take in Class or Object parameters, since the latter methods involve hash lookups to resolve to ClassMeta parameters.