[jdom-interest] JDOM Performance

Jason Hunter jhunter at servlets.com
Fri Jun 6 11:13:29 PDT 2003

> I haven't looked, but if this is what JDOM is doing when building a 
> document from a parse it's probably a poor choice for performance. The 
> key issue is that the characters() method of the handler *may* be called 
> more than once for a single character data item, but about 99.99 percent 
> of the time *won't* be. The most efficient approach to take is just to 
> create a String directly on the first call, rather than use a 
> StringBuffer. If you get called again, you just append to the existing 
> String to create a new one. I think this is what dom4j does.
>  - Dennis

We use a special reusable TextBuffer class optimized for for this usage.


More information about the jdom-interest mailing list