1.

Can The Performance Of Xstream Be Increased?

Answer»

XStream is a generalizing library, it inspects and handles your TYPES on the fly. Therefore it will normally be slower than a PIECE of optimized Java code generated out of a schema. However, it is possible to increase the performance anyway:

  • Write custom CONVERTERS for those of your types that occur very often in your XML.
  • Keep a configured XStream instance for multiple usage. Creation and initialization is quite expensive compared to the overhead of XStream when calling marshall or unmarshal.
  • Use Xpp3 or StAX parsers.

NOTE, you should never try to optimize code for performance simply because you believe that you have detected a bottle neck. Always use proper tools like a profiler to verify where your HOTSPOTS are and whether your optimization was really successful or not.

XStream is a generalizing library, it inspects and handles your types on the fly. Therefore it will normally be slower than a piece of optimized Java code generated out of a schema. However, it is possible to increase the performance anyway:

Note, you should never try to optimize code for performance simply because you believe that you have detected a bottle neck. Always use proper tools like a profiler to verify where your hotspots are and whether your optimization was really successful or not.



Discussion

No Comment Found