Re: [xsl] Seek ways to make my streaming XSLT code run faster (My streaming XSLT program has been running 12 hours and is only a quarter of the way to completion)

Subject: Re: [xsl] Seek ways to make my streaming XSLT code run faster (My streaming XSLT program has been running 12 hours and is only a quarter of the way to completion)
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Aug 2025 03:57:39 -0000
On Mon, Aug 11, 2025 at 03:39:39AM +0000, Liam R. E. Quin liam@xxxxxxxxxxxxxxxx scripsit:
> Without streaming, you can
> (1) read the auxilliary Identifiers file into a map, such that
>     $identifiers("ABC ") exists if and only if "ABC " is in the Identifiers
> file.
> 
> (2) process each record in turn, and see if it has an identifier that's in the
> map
>     <xsl:if test="$identifiers{VOR_Identifier} = 1">
>       then we want this record
>   (having already eliminated the ones with SID_Identifier in the match pattern.
> 
> Since map access is likely somewhere between O(1) and O(log n), this should be
> fast.

And if you need to do something with the various identifiers, you can
create a bunch of functions and map each identifier value to the
appropriate function reference and use that map to process a copy of the
record. More or less

<xsl:template match="record[not(SID_Identifier)][map:contains($identifiers,VOR_Identifier)]">
    <xsl:variable name="temp" as="element()">
      <xsl:copy-of select="."/>
    </xsl:variable>
    <xsl:sequence select="$identifiers(VOR_Identifier)($temp)"/>
</xsl:template>

Plus another template to collect those records we were not expecting and
did not match.

-- Graydon

--  
Graydon Saunders  | graydonish@xxxxxxxxxxxx
\xDE\xE6s ofer\xE9ode, \xF0isses sw\xE1 m\xE6g.
-- Deor  ("That passed, so may this.")

Current Thread