Rewriting as a practical optimization technique in GHC: Is it really needed?

前端 未结 3 1216
南旧
南旧 2021-02-01 17:00

I was reading the paper authored by Simon Peyton Jones, et al. named “Playing by the Rules: Rewriting as a practical optimization technique in GHC”. In the second se

3条回答
  •  执笔经年
    2021-02-01 17:58

    Something in that direction was investigated in a Bachelor’s thesis of Johannes Bader, a student of mine: Finding Equations in Functional Programs (PDF file).

    To some degree it is certainly possible, but

    • it is quite tricky. Finding such equations is in a sense as hard as finding proofs in a theorem proofer, and
    • it is not often very useful, because it tends to find equations that the programmer would rarely write directly.

    It is however useful to clean up after other transformations such as inlining and various form of fusion.

提交回复
热议问题