This is a major milestone for class optimization---the old anyValue-based
system is no longer in use; the classification system has been wholly
rewritten.

The ticks in the sampling profiler are now where they should be, open to
further optimization with a much more solid foundation.

  [JavaScript]:
     ticks  total  nonlib   name
        5    0.6%    3.0%  LazyCompile: *vu [...]/ui/package.strip.js:25191:16
        5    0.6%    3.0%  LazyCompile: *M [...]/ui/package.strip.js:25267:15
        3    0.4%    1.8%  LazyCompile: *vmu [...]/ui/package.strip.js:25144:17
        3    0.4%    1.8%  LazyCompile: *ve [...]/ui/package.strip.js:25204:16
        2    0.2%    1.2%  LazyCompile: *precision [...]/ui/package.strip.js:25137:23
        2    0.2%    1.2%  LazyCompile: *me [...]/ui/package.strip.js:25178:16
        2    0.2%    1.2%  LazyCompile: *cmatch [...]/ui/package.strip.js:25495:20
        2    0.2%    1.2%  LazyCompile: *ceq [...]/ui/package.strip.js:25273:17
        1    0.1%    0.6%  LazyCompile: *init_defaults [...]/ui/package.strip.js:25624:27
        1    0.1%    0.6%  LazyCompile: *MM [...]/ui/package.strip.js:25268:16
        1    0.1%    0.6%  LazyCompile: *E [...]/ui/package.strip.js:25239:15
        1    0.1%    0.6%  LazyCompile: *<anonymous> [...]/ui/package.strip.js:25184:13
        1    0.1%    0.6%  LazyCompile: *<anonymous> [...]/ui/package.strip.js:25171:13

Much better than the 102 ticks that anyValue was taking some time ago!

A lot of time used to be spent compiling functions as well, a lot of which
was removed by previous commits, bringing us to:

 [C++]:
   ticks  total  nonlib   name
     50    5.9%   30.5%  node::contextify::ContextifyContext::CompileFunction(v8::FunctionCallbackInfo<v8::Value> const&)
     20    2.4%   12.2%  write
      9    1.1%    5.5%  node::native_module::NativeModuleEnv::CompileFunction(v8::FunctionCallbackInfo<v8::Value> const&)
      6    0.7%    3.7%  __pthread_cond_timedwait
      4    0.5%    2.4%  mmap

All of this work has simplified the output enough that it's obviated a slew
of other optimizations that can be done in future work, though a lot of that
may wait for TAMER, since performing them in XSLT will be difficult and not
performant; the compiler is slow enough as it is.
master
Mike Gerwitz 2021-01-26 16:34:26 -05:00
parent 542ff46b6d
commit 8147bec24f
1 changed files with 54 additions and 2 deletions

View File

@ -716,7 +716,50 @@
<sequence select="concat( $var, '=Em(', $yield-to, '=', $js, ');' )" />
</when>
<!-- all vectors with @value/@anyOf -->
<when test="$nm > 0 and $nv = 0 and $ns > 0
and empty( $matrices[ not( @value or @anyOf or c:* ) ] )
and empty( $scalars[ not( @value or @anyOf or c:* ) ] )">
<variable name="js-matrix" as="xs:string"
select="compiler:optimized-matrix-matches(
$symtable-map, ., $matrices )" />
<variable name="js-scalar" as="xs:string"
select="compiler:optimized-scalar-matches(
$symtable-map, ., $scalars )" />
<variable name="js" as="xs:string"
select="concat( 'sm', $ctype, '(',
$js-matrix, ',', $js-scalar, ')' )" />
<sequence select="concat( $var, '=Em(', $yield-to, '=', $js, ');' )" />
</when>
<when test="$nm > 0 and $nv > 0 and $ns > 0
and empty( $matrices[ not( @value or @anyOf or c:* ) ] )
and empty( $vectors[ not( @value or @anyOf or c:* ) ] )
and empty( $scalars[ not( @value or @anyOf or c:* ) ] )">
<variable name="js-matrix" as="xs:string"
select="compiler:optimized-matrix-matches(
$symtable-map, ., $matrices )" />
<variable name="js-vec" as="xs:string"
select="compiler:optimized-vec-matches(
$symtable-map, ., $vectors )" />
<variable name="js-scalar" as="xs:string"
select="compiler:optimized-scalar-matches(
$symtable-map, ., $scalars )" />
<variable name="js" as="xs:string"
select="concat( 'sm', $ctype, '(',
'vm', $ctype, '(',
$js-matrix, ',', $js-vec, '),',
$js-scalar,
')' )" />
<sequence select="concat( $var, '=Em(', $yield-to, '=', $js, ');' )" />
</when>
<when test="$nm = 0 and $nv > 0
and empty( $vectors[ not( @value or @anyOf or c:* ) ] )">
<variable name="jsvec" as="xs:string"
@ -739,7 +782,6 @@
$js, ');' )" />
</when>
<!-- all scalars with @value -->
<when test="$nm = 0 and $nv = 0 and $ns > 0
and empty( $scalars[ not( @value or @anyOf or c:* ) ] )">
<sequence select="concat( $var, '=!!(', $yield-to, '=',
@ -1840,6 +1882,16 @@
return v.map(x => x | s);
}
// apply scalar to matrix
function smu(m, s)
{
return m.map(v => v.map(x => x & s));
}
function sme(m, s)
{
return m.map(v => v.map(x => x | s));
}
// existential (any)
function E(v)