[m-rev.] for review: start using type_spec_constrained_preds pragmas

Julien Fischer jfischer at opturion.com
Fri Feb 9 18:40:26 AEDT 2024


On Fri, 9 Feb 2024, Zoltan Somogyi wrote:

> On 2024-02-09 17:57 +11:00 AEDT, "Julien Fischer" <jfischer at opturion.com> wrote:
>>> My laptop's timings are too variable to be able to measure
>>> the speed impact of this diff. For tools/speedtest, I got a 0.7%
>>> speedup; for tools/bootcheck -j6, approx the same slowdown.
>>> If someone with a less volatile machine could try it out,
>>> I would be grateful.
>>
>> I will do so. I did try an earlier version of this change out on my JSON
>> library and got a very small speedup. I have some theories about why
>> this is, but need to have closer look at what the compiler is doing.
>
> Thank you.
>
> My guess is that
>
> - the fraction of the time that the compiler spends in the specialized code
>  is small (in fact, it should be zero on invocations that don't write to
>  .int* or .*opt files, or generate error messages), and
>
> - the speedup of that fraction is probably itself at the few-percent-at-most
>  level.
>
> That's why I don't think tools/speedtest is a particularly good test.
> Doing timings of building .intN and/or .*opt files would be better.

I will try both.

>> Question: is there a definitive list of what's allowed to appear inside
>> .opt files somewhere? The list given in the comment at the top of
>> compiler/intermod.m is incomplete: it doesn't mention typeclasses or
>> instances for example.
>
> Fergus and Simon did not leave any such documentation. I added
> it for .intN files to notes/interface_files.html, though it is not complete.
>
> For .*opt files, the best info is the definitions of the parse_tree_plain_opt
> and parse_tree_trans_opt types in prog_item.m. I derived those from the
> code in intermod.m, and every kind of item in them *is* actually something
> that the compiler can put into .*opt files.

What prompted my question was looking into why the instance definition
for unboxed_reader(text_input_stream, char, io, io.error) isn't being
put into io.opt. The answer is that we do not write out instance
definitions that contain clauses into .opt files -- see the XXX in
compiler/intermod_decide.m.

...

> The module comment of intermod.m should be modified to point
> to prog_item.m. Do you want to do it, or should I?

Feel free to update it.

Julien.


More information about the reviews mailing list