prperoc/template: Use symtable map instead of preproc:symtable XPaths

This is more of the same, utilizing the map I created previously.  The
results are pretty significant; this commit and the previous cuts ~3.5m of
build time (if done serially) off of our largest system.

My goal is to get non-parallelizable portions of our build down to the point
where they are no longer the bottleneck.  This just about does that.

DEV-15095
main
Mike Gerwitz 2023-10-12 15:58:25 -04:00
parent 7ccf0a0cfa
commit 0b04807cfd
1 changed files with 16 additions and 14 deletions

View File

@ -152,7 +152,7 @@
<when test="$tpl"> <when test="$tpl">
<!-- avoid a costly repass; apply immediately --> <!-- avoid a costly repass; apply immediately -->
<sequence select="preproc:expand-template( <sequence select="preproc:expand-template(
$tpl, $src-root, $params, . )" /> $symtable-map, $tpl, $src-root, $params, . )" />
</when> </when>
<otherwise> <otherwise>
@ -242,12 +242,12 @@
<!-- immediately apply without a wasteful repass --> <!-- immediately apply without a wasteful repass -->
<sequence select="preproc:expand-template( <sequence select="preproc:expand-template(
$tpl, $src-root, $params, . )" /> $symtable-map, $tpl, $src-root, $params, . )" />
</when> </when>
<when test="$tpl"> <when test="$tpl">
<sequence select="preproc:expand-template( <sequence select="preproc:expand-template(
$tpl, $src-root, lv:with-param, . )" /> $symtable-map, $tpl, $src-root, lv:with-param, . )" />
</when> </when>
<otherwise> <otherwise>
@ -267,6 +267,8 @@
<function name="preproc:expand-template"> <function name="preproc:expand-template">
<param name="symtable-map" as="map(*)" />
<param name="tpl" as="element( lv:template )" /> <param name="tpl" as="element( lv:template )" />
<param name="src-root" /> <param name="src-root" />
<param name="params" as="element( lv:with-param )*" /> <param name="params" as="element( lv:with-param )*" />
@ -327,6 +329,8 @@
<with-param name="first-child" select="true()" /> <with-param name="first-child" select="true()" />
<with-param name="src-root" select="$src-root" <with-param name="src-root" select="$src-root"
tunnel="yes" /> tunnel="yes" />
<with-param name="symtable-map" tunnel="yes"
select="$symtable-map" />
</apply-templates> </apply-templates>
</preproc:tpl-barrier> </preproc:tpl-barrier>
</variable> </variable>
@ -335,6 +339,8 @@
select="$apply-result"> select="$apply-result">
<with-param name="tpl-name" select="$name" <with-param name="tpl-name" select="$name"
tunnel="yes" /> tunnel="yes" />
<with-param name="symtable-map" tunnel="yes"
select="$symtable-map" />
</apply-templates> </apply-templates>
<!-- since templates can include anything, we should perform another pass <!-- since templates can include anything, we should perform another pass
@ -1301,6 +1307,7 @@
--> -->
<template mode="preproc:gen-param-value" priority="5" <template mode="preproc:gen-param-value" priority="5"
match="lv:param-class-to-yields"> match="lv:param-class-to-yields">
<param name="symtable-map" as="map(*)" tunnel="yes" />
<param name="params" as="element( lv:with-param )*" <param name="params" as="element( lv:with-param )*"
tunnel="yes" /> tunnel="yes" />
@ -1313,11 +1320,8 @@
<variable name="as" select="$params[ @name=$pname ]/@value" /> <variable name="as" select="$params[ @name=$pname ]/@value" />
<!-- get @yields from class --> <!-- get @yields from class -->
<variable name="yields" select=" <variable name="yields"
$src-root/preproc:symtable/preproc:sym[ select="$symtable-map( concat( ':class:', $as ) )/@yields" />
@name=concat( ':class:', $as )
]/@yields
" />
<choose> <choose>
<when test="not( $yields ) or $yields=''"> <when test="not( $yields ) or $yields=''">
@ -1340,6 +1344,7 @@
--> -->
<template mode="preproc:gen-param-value" priority="5" <template mode="preproc:gen-param-value" priority="5"
match="lv:param-sym-value"> match="lv:param-sym-value">
<param name="symtable-map" as="map(*)" tunnel="yes" />
<param name="params" as="element( lv:with-param )*" <param name="params" as="element( lv:with-param )*"
tunnel="yes" /> tunnel="yes" />
@ -1358,9 +1363,7 @@
<!-- get @yields from class --> <!-- get @yields from class -->
<variable name="sym-value" as="xs:string?" select=" <variable name="sym-value" as="xs:string?" select="
$src-root/preproc:symtable/preproc:sym[ $symtable-map( $sym-name )/@*[ local-name() = $value ]" />
@name = $sym-name ]
/@*[ local-name() = $value ]" />
<choose> <choose>
<when test="not( $sym-value ) or $sym-value = ''"> <when test="not( $sym-value ) or $sym-value = ''">
@ -1403,6 +1406,7 @@
--> -->
<template mode="preproc:gen-param-value" priority="5" <template mode="preproc:gen-param-value" priority="5"
match="lv:param-typedef-lookup"> match="lv:param-typedef-lookup">
<param name="symtable-map" as="map(*)" tunnel="yes" />
<param name="params" as="element( lv:with-param )*" <param name="params" as="element( lv:with-param )*"
tunnel="yes" /> tunnel="yes" />
@ -1422,9 +1426,7 @@
select="$params[ @name = $value ]/@value" /> select="$params[ @name = $value ]/@value" />
<variable name="typedef-sym" as="element( preproc:sym )" <variable name="typedef-sym" as="element( preproc:sym )"
select="$src-root/preproc:symtable/preproc:sym[ select="$symtable-map( $typedef-name )[ @type = 'type' ]" />
@name = $typedef-name
and @type = 'type' ]" />
<variable name="typedef-pkg" as="element( lv:package )" <variable name="typedef-pkg" as="element( lv:package )"
select="if ( $typedef-sym/@src ) then select="if ( $typedef-sym/@src ) then