Closed amosr closed 6 years ago
A lot of the duplicated work is just floating point operations. So it's not going to make a big difference in runtime. Perhaps even slightly slower, depending on register pressure. But making the environment smaller should speed up constructor
a bit, as well as producing smaller output code.
! @jystic @tranma forgot jury
ok, this made sense. 👍
A while ago I noticed some duplicate work in the flattened avalanche:
The
div#
gets duplicated into two places! The constructor transform is putting every let-binding it sees in the environment, and when trying to meltright# anf-0
looks up the arguments in the environment, so it ends up inlining the definition ofanf-0
.I think it only needs to inline things which are going to cause a melt/unmelt transform to fire: so values, melt prims, unmelt prims, as well as variables which might point to any of those. Is that sufficient?