[OCaml'25] Taming the Flat Float Array Optimization: Tracking Separability in the Type System
Taming the Flat Float Array Optimization: Tracking Separability in the Type System (Video, OCaml 2025) Diana Kalinichenko, and Richard A. Eisenberg (Jane Street; Jane Street) Abstract: OCamlβs flat float array optimization stores floating-point values directly in arrays rather than through pointers, preventing performance degradation for numerical algorithms. However, this optimization requires that all types be \textit{separable} β containing either all float values or none. This restriction prevents certain useful types, such as unboxed existentials and an unboxed version of options. We present the approach taken by OxCaml (OCaml with Jane Streetβs extensions) to tracking separability through the type system using a three-valued separability axis. This design enables previously rejected non-separable types while maintaining compatibility with existing code and enabling new optimizations for arrays of known non-float types. Our implementation builds on OxCamlβs kind system but could
βhttps://watch.ocaml.org/w/eAdpqFJRZUjYJjfQoXcda9