Optimizing Layout of Recursive Datatypes with Marmoset
Vidush Singhal, Chaitanya Koparkar, Joseph Zullo, Artem Pelenitsyn,, Michael Vollmer, Mike Rainey, Ryan Newton, Milind Kulkarni

TL;DR
Marmoset is a compiler that optimizes the memory layout of recursive algebraic data types to improve traversal efficiency, outperforming traditional and baseline approaches in microbenchmarks and case studies.
Contribution
It introduces a novel layout optimization technique for recursive data types, integrating constraint solving and analysis to produce highly efficient memory layouts.
Findings
Marmoset outperforms Gibbon's baseline in microbenchmarks.
Marmoset surpasses MLton in case studies.
Optimized layouts enable minimal pointer chasing for recursive structures.
Abstract
While programmers know that the low-level memory representation of data structures can have significant effects on performance, compiler support to optimize the layout of those structures is an under-explored field. Prior work has optimized the layout of individual, non-recursive structures without considering how collections of those objects in linked or recursive data structures are laid out. This work introduces Marmoset, a compiler that optimizes the layouts of algebraic datatypes, with a special focus on producing highly optimized, packed data layouts where recursive structures can be traversed with minimal pointer chasing. Marmoset performs an analysis of how a recursive ADT is used across functions to choose a global layout that promotes simple, strided access for that ADT in memory. It does so by building and solving a constraint system to minimize an abstract cost model,…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
