GADTs for performance

I’ve heard @Yaron_Minsky mention in a few talks and podcasts that GADTs can be used to improve performance, specifically around memory layout.

Does anyone have any examples of how this would work?

Is there a recording of this presentation anywhere? http://www.cs.cmu.edu/afs/.cs.cmu.edu//Web/Posters/POP-YMinsky17.pdf

I think the details in this article really help understand https://blog.janestreet.com/why-gadts-matter-for-performance/.

Like so much of the performance focus, it’s not valid in most cases and is generally about controlling memory location.

3 Likes

I’m not sure about “not valid in most cases”. Controlling memory matters in many kinds of real-world applications. And I’m really excited about some work we’re doing for making it easier in OCaml. This talk fro Stephen Dolan is an exciting preview of that work.

There’s also an RFC worth reading.

10 Likes

@Yaron_Minsky It’s really exciting work! Is the plan to have this in ocaml trunk eventually?

The discussion on this RFC is very much open at this point. Personally, in reference to Stephen Dolan’s talk title, I prefer Lisp to C++.

5 Likes

I very much prefer Lisp as a language over C++, but being able to represent data in a more compact way for performance when needed doesn’t sound like a bad idea to me! I’m purely speaking without any language design / implementation experience :smile:

1 Like