purescript-backend-optimizer icon indicating copy to clipboard operation
purescript-backend-optimizer copied to clipboard

Add inlining directives for data types

Open natefaubion opened this issue 2 years ago • 1 comments

This is a very basic implementation of #72 which might help with things such as large generics inlining. Adding a directive such as:

-- @inline Data.Generic.Rep.Sum always

Will make the optimizer extremely eager to distribute a continuation over bindings that evaluate to a known constructor of type Sum. Note that the directive is on the data type, not individual constructors.

cc @MonoidMusician Any thoughts on this approach?

natefaubion avatar Apr 13 '24 16:04 natefaubion

@MonoidMusician I've adjusted the heuristics so that the large generics example will inline without needing an annotation on the generics data types. I would love to hear if you have any thoughts or improvements to these.

natefaubion avatar Apr 14 '24 18:04 natefaubion