Skip to content

Qi Compiler Sync Jan 13 2023

Siddhartha Kasivajhula edited this page Jan 26, 2023 · 3 revisions

A Mystery and a Wild Goose Chase

Qi Compiler Sync Jan 13 2023

Adjacent meetings: Previous | Up | Next

Summary

We investigated the cause of slowdowns in amp and loop forms and found some answers, while some questions remain.

Background

In beginning to restore the performance of forms to pre-stratification levels (as discussed last time), we started by looking at degradation in core forms. That is, since our assumption is that the performance degradation is caused by extended forms compiling to an as-yet-unoptimized core language, we would not expect any core forms to have degraded performance from before. Yet, amp and loop are core forms, and the former is 2x as slow and the latter is >10x as slow as it formerly was, according to benchmarks.

Loop

We decided to macroexpand the loop form to see if the expansion looked any different from the original implementation on the main branch. The expansions for the two looked almost identical, and we spent some time investigating the few differences that we could see (e.g. an instance of #%app:18 vs #%app, and the presence of let-values, which turned out to be red herrings). But in the end, it turned out that the code we had expanded (a unit test) wasn't the actual code that was running in the benchmark (I blame the spectre of Friday the 13th casting a spell on me), and in fact, the benchmark featured a use of live? which is known to be much slower in the compiler branch than in main (and is not a core form). Expanding the benchmark code revealed big differences in the expansions which accounted for the difference in performance of loop. In other words, the slowdown was in the benchmark and not in the core form itself.

Amp

In the time we had remaining, we briefly looked at amp and there didn't seem to be anything obviously different about it, either in the benchmark or in the implementation of the form. So the difference in performance here remains a mystery, for now.

Next Steps

(Some of these are carried over from last time)

  • Investigate amp.
  • Continue restoring performance of other slow forms.
  • Add docs for syntax-spec and put it on the package index.
  • Review the initial design for bindings and see what other bindings cases we could support next.

Attendees

Hans, Michael, Nia, Sid

Clone this wiki locally