Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] StackOverflowError compiling XOM

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: elharo AT metalab.unc.edu
  • Cc: cowwoc <cowwoc AT bbs.darktech.org>, xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] StackOverflowError compiling XOM
  • Date: Mon, 12 Jan 2009 18:26:54 -0800

I've now checked in a patch I hope will improve matters with this class and function. In brief the getCombiningClass method now looks like this:

private static int getCombiningClass(int character) {

if (character <= 0x2ff) return CANONICAL_COMBINING_CLASS_NOT_REORDERED;
if (character <= 0x314) return CANONICAL_COMBINING_CLASS_ABOVE;
if (character <= 0x315) return CANONICAL_COMBINING_CLASS_ABOVE_RIGHT;
if (character <= 0x319) return CANONICAL_COMBINING_CLASS_BELOW;
if (character <= 0x31a) return CANONICAL_COMBINING_CLASS_ABOVE_RIGHT;
if (character <= 0x31b) return CANONICAL_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT;
if (character <= 0x320) return CANONICAL_COMBINING_CLASS_BELOW;
// ...

The result is that there are now only about as third as many lines of code and even fewer operations. Furthermore, the tests are ordered by code point so strings containing only Latin characters should be very fast.

If there's demand fro improving this still further, there are some table lookup tricks I can play. However, first I'd like to know if this improves matters for folks who were having trouble with the older, larger code. I'll try and check and see if Clover can handle this myself.


Longer term, I'd like to integrate the code generation into the build process. I'd also love to see a lot more unit tests for the various cases. The testing now is far from exhaustive.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
Refactoring HTML Just Published!
http://www.amazon.com/exec/obidos/ISBN=0321503635/ref=nosim/cafeaulaitA




Archive powered by MHonArc 2.6.24.

Top of Page