editor icon indicating copy to clipboard operation
editor copied to clipboard

MoLang: Test whether custom function is side effect free & then completely resolve it at compile time

Open solvedDev opened this issue 3 years ago • 4 comments

side effect free: Static arguments, no var. access, ...

solvedDev avatar Oct 10 '21 17:10 solvedDev

I could look into this later this year. I plan on looking at the constant folding / common subexpression elimination, so I could take a look at this too (as well as #154)

Tschipp avatar Jul 08 '22 14:07 Tschipp

What would be the benefit of this feature? A smaller file size?

outercloudstudio avatar Jul 08 '22 15:07 outercloudstudio

Also better performance within Minecraft. The most performant code is code that doesn't exist

solvedDev avatar Jul 08 '22 18:07 solvedDev

Exactly. In my project, we have a lot of math based animations, that are in essence just some sin/cos with some constant factors, but those factors are often spread out over several additions and multiplications. This is currently already a feature, but it only optimizes from left to right, and not right to left. Doing both could save some operations.

Tschipp avatar Jul 09 '22 07:07 Tschipp