Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Three cosmetic patches

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Three cosmetic patches
  • Date: Tue, 10 Feb 2004 12:24:04 -0800

Elliotte Rusty Harold wrote:
Here are some cosmetic patches against d24.
The first two avoid some code duplication, and the third makes it a bit more efficient.


Have you measured this to prove it makes the code more efficient?

The first two patches make the code more readable and better structured, and performance difference should be negligible.

I presume you mean the third patch about iteration vs. recursion.
Nope, i haven't measured it. But what i gathered from CS studies and benchmarks years ago is that iteration is always faster than recursion because it avoids function calls, stack allocations and deallocations, processor register state switching, allows better compiler optimizations because it increases optimization scope, better register allocation, etc. So the bottom line is it is faster (but i don't know how much) and it certainly isn't slower. I've heard mails a while ago on the list that sounded a bit uneasy about the potential performance hit of extensive tree walking for correctness checking, so I thought that patch would help and certainly can't hurt, given that the proposed code is just as clean, concise and understandable as the old one.

If you believe isAncestor() is unlikely to ever be a hotspot, the discussion is moot of course.

Wolfgang.





Archive powered by MHonArc 2.6.24.

Top of Page