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

Generated code for case match on instances are heaavy

Open imsaravana369 opened this issue 1 year ago • 1 comments

For this code

The code generated by purescript-optimized backed is more than 17K+ line

imsaravana369 avatar Jan 03 '25 11:01 imsaravana369

That isn't surprising to me. Any translation of a DAG (pattern matching) to trees (if/else) has the potential for exponential blowup. The chances of this happening increase with the size and complexity of the pattern matrix. For something like this, I would potentially rewrite this with guards to avoid the blowup, since you don't need to exhaustively enumerate your patterns.

natefaubion avatar Jan 03 '25 17:01 natefaubion