Last week we discussed the incorrect usage of Java EE in the EJAPP Top 10 countdown. After that very broad topic, it's time for a very specific one on number 7.
The unnecessary use of XML is a boon to the performance of your Java EE application. XML has a number of interesting properties that cause it to be used for a whole range of functions in the average Enterprise Java application:
Someone once said that "XML is the noun and Java is the verb" and that has caught on. Unfortunately XML processing is heavy on CPU cycles and on memory usage.
This performance hit can be traced to a number of areas:
When parsing an XML document, choose the parser that suits your needs, set its features (do you need validation? can you use a local DTD?) , and tune its performance.
Even though it is possible to tune the performance of your XML parser, transformer, and data binding framework, XML processing is never going to beat property files (for configuration files), Java serialization (for remoting), or plain CSV files and SQL databases (for data storage) when it comes down to performance. So don't choose XML just because it is the hip thing to do!
Filed under Java, Performance, XML |