[jdom-interest] New benchmark

Bradley S. Huffman hip at a.cs.okstate.edu
Tue Jul 2 13:00:30 PDT 2002


Jason Hunter writes:

> http://xmlhack.com/read.php?item=1706
> 
> Interesting reading.  JDOM's looking pretty good (and that's
> particularly impressive since b8 had the StringBuffer performance bug).  
> 
> But look at the last chart.  There's clearly some bug there we need to
> track down!

Hmmm, looks more like a case of either not reading the docs., or us not
being clear/obvious enough in our docs. But looking in
org.xperf.xpb.xstat.jdom.JDOMProcessor.java, I see

  private void collectStat(Element elem, StatCollector sc)
    {
	sc.element(elem);
	List children = elem.getChildren();
	for (int i = 0; i < children.size(); i++)
	  collectStat((Element)children.get(i), sc);
	}

However the javadocs for Element.getChildren() states

    Sequential traversal through the List is best done with a Iterator since
    since the underlying implement of List.size() may not be the most efficient.

Bet you if the code is change to use a Iterator, the times would look a whole
lot better.  Maybe a nice note to Mr. Kumar would be appropiate :)

Brad



More information about the jdom-interest mailing list