Graydon Hoare: 21 compilers and 3 orders of magnitude in 60 minutes

Lambda the Ultimate - Programming Languages Weblog 2022-02-27

Summary:

In 2019, Graydon Hoare gave a talk to undergraduates (PDF of slides) trying to communicate a sense of what compilers looked like from the perspective of people who did it for a living.

I've been aware of this talk for over a year and meant to submit a story here, but was overcome by the sheer number of excellent observations. I'll just summarise the groups he uses:

  • The giants: by which he means the big compilers that are built the old-fashioned way that throw massive resources at attaining efficiency
  • The variants, which use tricks to avoid being so massive:
    1. Fewer optimisations: be traditional, but be selective and only the optimisations that really pay off
    2. Use compiler-friendly languages, by which he is really taking about languages that are good for implementing compilers, like Lisp and ML
    3. Theory-driven meta-languages, esp. how something like yacc allows a traditional Dragon-book style compiler to be written more easily
    4. Base compiler on a carefully designed IR that is either easy to compile or reasonable to bytecode-interpret
    5. Exercise discretion to have the object code be a mix of compiled and interpreted
    6. Use sophisticated partial evaluation
    7. Forget tradition and implement everything directly by hand

I strongly recommend this talk. While much of the material I was familiar with, much was new, and I really appreciated the shout-outs to projects that deserve more visibility, such as Nanopass compilers, CakeML, and compilers based on the Futamura projections.

Link:

http://lambda-the-ultimate.org/node/5648

From feeds:

Gudgeon and gist ยป Lambda the Ultimate - Programming Languages Weblog

Tags:

implementation

Date tagged:

02/27/2022, 14:13

Date published:

02/27/2022, 09:47