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?

1 Like

I think the details in this article really help understand

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


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.


@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++.


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