Posts

Showing posts with the label Performance

How to update XML file without reformatting it

Recently, I needed to modify content of a few thousands XML files. The modification itself was nontrivial and consisted of reading two attributes from an element and then updating a value of a previously read attribute. And to make it even more interesting, I wanted to keep the formatting of all files intact. My goal was creating a reusable utility that could be used also in the future, should such a need rise again. Because of the need to preserve the formatting, I rejected all tools I usually use (Dom4j, SAX, Jaxb) and started to search for a suitable tool. Finally I found the answer in a form of a recommendation on http://stackoverflow.com , the tool recommended was VTD-XML (or on github ).

Log performance impact tuning

I have read about logging performance impact many times, but I have never seen with my own eyes. That changed once I accidentally run full set of integration tests with full logging on, which took twice as long as with no log on. That changed my look on logging and now I will never look at a logger line the same way. The log's impact on application's performance is significant. It is definitely more than I anticipated and what is the worst part, it can be easily worsened by using a logger inappropriately. In this post, I will demonstrate how a small variance in logging line of code can make a huge difference in application's performance.

Performance of the string switch statement

Image
One of the new Java 7 features is possibility to use String values in switch statements. Proper usage of this can be found for example in oracle tutorials . But what i wanted to know is how fast is that. Is the new way faster, than a series of if-else statements, or is it slower?