[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Lookup efficiency in XALAN vs. Saxon

Subject: RE: Lookup efficiency in XALAN vs. Saxon
From: JWolpert@xxxxxxxxxxx
Date: Thu, 20 Nov 2003 16:07:26 -0800
xslt error java.lang.outofmemoryerror
Wendell,
	thanks for the two ideas.... Unfortunately... 

	using a variable, allow it to die much earlier (after 30 records)
with the same 
	"(Location of error unknown)XSLT Error (java.lang.OutOfMemoryError):
null"

	and the second method (with xsl:key) died before processing any
records, again with the same 
	"(Location of error unknown)XSLT Error (java.lang.OutOfMemoryError):
null"

	does Saxon or any other xslt processors deal with this simple table
lookup any better?

Jake


-----Original Message-----
From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx] 
Sent: Thursday, November 20, 2003 3:05 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Lookup efficiency in XALAN?


J,

At 04:45 PM 11/20/2003, you wrote:
>I have to do some validation in my xsl.
>
>I'm doing the following type statement 20,000 times, and the lookup 
>file is around 50,000  lines of  id's <id key="XXYYZZJ"/>.
>
><xsl:when 
>test="not(document('../master/ids-master.xml')/ids/id[@key=$id])">
>
>It works for a while, then dies with an out of memory error, and it 
>sure is slow!

The first thing you should definitely do is collect the lookup ids into a 
variable, as in

<xsl:variable name="keys" 
select="document('../master/ids-master.xml')/ids/id/@key"/>

Then you can test your local ids against the keys in the variable, without 
parsing your lookup file every time (which it sounds like your processor 
might be doing):

<xsl:when test="not($id = $keys])">

Try that and see if it helps.

If Xalan is already optimizing the document() lookup and parse, you may get 
no gain from this technique -- but there's no way it could hurt.

XSLT keys could also help, but since your keys are in a separate document 
you'd have to switch contexts to use the XSLT key function, like so:

<xsl:key name="keys-by-id" match="id" use="@key"/>

<xsl:variable name="keyfile" select="document('../master/ids-master.xml')"/>

... and then

<xsl:for-each select="$keyfile">
   <xsl:when test="not(key('keys-by-id', $id))">...</xsl:when>
</xsl:for-each>

but whether this helps also will depend on your processor and what kind of 
smarts it has inside.

Cheers,
Wendell


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.