A couple of months ago, Pascal noticed some missed optimizations in OCaml’s float unboxing optimizations. In some cases, code that looked like it should be compiled down to a sequence of allocation-free floating point operations turned out to involve quite a lot of allocation, with floats getting boxed and then immediately unboxed for no purpose. The fact that the compiler missed this particular optimization forced us in a few spots to do some ugly manual inlining, and generally made us sad.

But we are sad no more! We filed a bug report, and it just got fixed in OCaml’s CVS. You can see the details here. Now all we’re waiting for is a fix to the missed optimization for equality on polymorphic variants.