Rework Index preresolve algorithm
Summary:
When building the Index in HHBBC, most of the time (by far) is taken
up by the preresolve step. This step is responsible for building all
ClassInfos and populating them with all relevant information. This
includes flattening traits into their use classes, and flattening
other information into each class.
The reason this step takes so long is because its relatively
inefficient. For every class, it walks up its entire inheritance tree
and pulls in information for all parents/traits/interfaces. This is
wasteful because it performs a lot of duplicate work.
Rework the algorithm to be more iteratively. Instead of starting at
each class and working upward (many times), work downward. Start at
parent-less classes, calculate the information they would export to
their children/uses, then mark those classes as done. Now repeat the
process for any classes which have only done parents. Important the
information from parents, update it depending on the class, then
export that. Repeat this process until all classes have been
processed. This scheme is much faster because every class is only
processed once.
Differential Revision:
D27994387
fbshipit-source-id:
afc3bfd07e1230084aee464dbbd7530d9e755b59