There are a few variations, but the key here is that CloseableIteratorSAX is getting a new instance of SAXParserFactory. The SAXParserFactory.newInstance method has to go off on a search through classloaders (probably to find a file indicating what parser implementation should be used). This results in filesystem activity, so there is some performance overhead. And we appear to be going down this path quite a bit.
I would expect that CloseableIteratorSAX could keep a single static instance of the SAXParserFactory, and then the constructor would just have to create a new SAXParser instance.
I'm adding the file that I changed that can be used as a refrence.
Log in to post a comment.