[dart2js] Speed up DominatedUses.of
- notes on statistics
#56945
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
dart2js-compile-time
dart2js-ssa
P3
A lower priority bug or feature request
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
web-dart2js
While fixing #56919, I did some analysis of the use patterns of
DominatedUses.of
.It is not clear that it is worth improving
DominatedUses.of
, but there is potential to make the query more efficient by using fewer data structures in_compute
. The hottest place is the call toSetlet.add
, where the LinkedHashSet lookup shows up as ~5% of compile time in pathological methods with thousands of back-to-back array accesses.Statistic on the use of
DominatedUses.of
for a large program.DominatedUses.of(source, dominator)
is a query that finds all the uses ofsource
that are a use by an instruction that is dominated bydominator
.For
-O4
, most (83%) of queries have a single input.Most (93%) of queries give an empty result set.
This is not surprising since the query is used to find places where we 'know more' about a value, and to learn something about a value, one of the uses of the value is the operation that tests or checks the value.
Excluding single-input queries the distributions are:
Over all queries there are a total of 16055198 inputs, of which 2194037, or 13.7%, find their way into a result. If we exclude the 5491527 single-input queries, then of the 10563671 inputs, 20.8% are in a result.
Larger queries are more expensive since they dominance-test each element of the input. While queries with more than 100 inputs are just 0.2% of queries, they are 24.2% of the work, and queries with more than 10 inputs (4.2% of the queries) are 72.3% of the work.
To summarize:
seen
andusers
) is a large component of that work.The above results are for
-O4
. Results for-O2
are similar. There are 12% more queries, but almost all are single-input queries for the implicit checks at method entry.The text was updated successfully, but these errors were encountered: