AngouriMath

Navigation

← Back to list of members

ApplicableTo​(System.​Type)

 Method (no overloads)

Summary

The rules whose pattern requires a root type this one is, cached per runtime type.

Remarks

A rule that cannot match still costs a virtual call and a type test to say so, and a
rewrite pass asks every rule of a set at every node of the tree. For a set of three
that is nothing, which is why the note above records a per-type index as measured and
rejected — and it was rejected on a set of three.
Thirty sets are data now, so a pass asks several hundred rules at every node where it
used to ask a handful, and the arithmetic has changed. Indexing is −36.0% of
SimplifyEasy
— 148,223 ns to 94,904 ns — with allocation identical to the
byte and ParseEasy, SolveEasy and SimplifyHard unmoved, so what it
removes is dispatch and nothing else.
What was rejected before was a cache that allocated per node. This allocates
once per runtime type ever seen and then never again, so a pass over a tree of
products and sums touches two entries and allocates nothing. The dictionary is only
ever added to, and adding is done on a copy that replaces the field, so a reader
racing a writer sees either the old map or the new one and never a torn one.

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online