Closed v-nys closed 8 years ago
The bottleneck seems to be in replace-first-subtree and replace-last-subtree. The logic behind the current version of those functions can be optimized for the abstract analysis scenario: replace-first-subtree is only ever applied recursively to a) the last child which already has an index b) the first child which does not yet have an index. All other children can simply be copied without being checked. For replace-last-subtree, the same observation holds (but we should check the first child without an index first).
Hopefully, this will speed the whole thing up considerably.
This won't lead to any major improvement for primes, because there we only get two children for each node so far. Contracts on map-accumulatel and map-accumulater seem to be a major bottleneck. Option contracts may provide a clean way to deal with this...
Found the problem! Was doing an expensive computation twice in a recursive function. With expressive contracts, proceeding on laptop takes at most a few seconds at depth 40-ish in primes program. That'll do for now.
As the analysis tree grows, unfolding becomes slower and slower. Building genealogical trees only slows things down further. Profiling may help to uncover and fix performance bottlenecks.