[m-rev.] for review: Optimise modechecking of coerce for large types.

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Apr 21 15:12:15 AEST 2021



On Wed, 21 Apr 2021 12:18:29 +1000, Peter Wang <novalazy at gmail.com> wrote:
> I'm going to abandon this
> patch and try to implement modechecking of coerce in some other way that
> does not involve generating potentially gigantic insts.

In the five or so years leading up to 2012, I implemented
a long series of changes to reduce the running time of the
compiler on a set of stress test inputs. Some of the changes
involved speeding up code dealing with large insts.
Though some worked by replacing them all with "ground",
which would not be useful for you, some of them could be
relevant. The overall work is described in the attached
unfinished paper, especially section 4, but it is probably not
detailed enough for you. You could possibly get useful ideas by 
ooking at the commit messages of the relevant diffs from that time
period. (Unfortunately, I don't have a list of them separated out
from all the other commit messages of that time.)

In the current case, what I can think of is that you don't need
*all* of each inst. A simple subtype inst will cover only the
top few layers of a term; a recursive subtype (or set of subtypes)
will usually cover more layers, but even they won't care about
the precise insts of subterms that are not in one of the cycles
between the subtypes. For your purposes, you could replace
*all* such insts with "ground". You *would* need a prepass
to figure out exactly *which* type constructors your cache will need
subtype insts for, but this should be doable just once, as a pass
over the type table.

By the way, I just realised that with one exception, my stress tests
are not in the git repository. I think they should be there.
I could add them as benchmarks/stress_tests. Any proposals
for better names? Or should I create a separate repository for them?

Zoltan.



More information about the reviews mailing list