Question: This suggestion you gave has really helped me fix a glitching problem in my jsfx plugin: "also, for JSFX in particular, variables (e.g. x) are a lot faster than memory (e.g. x[1]), and variables and constants are roughly similar in speed (e.g. using some_global_scale = 2.0 vs 2.0 directly in the code, no real difference)." Pls, I need another tip, lol, especially for reducing cpu usage or any other you deem very important?
Asked by Deeee (197.251.240.x) on May 5 2025, 7:25am
Reply on May 5 2025, 1:57pm:unrolling short loops is also a good idea:
ptr[0] *= 2.0;
ptr[1] *= 2.0;
ptr += 2;
is faster than:
loop(2, ptr[0] *= 2.0; ptr+=1; );
Also avoid unnecessary stores:
foo = (x*y+z)*3.0;
is faster than:
tmp = x*y+z;
foo = tmp * 3.0;
(within single statements, EEL2 does a decent job of optimizing, but it doesn't do much inter-statement optimization).
Comments:
- Posted by Deeee (197.251.240.x) on May 5 2025, 5:52pm:
Thank you very much, Justin. I'm going to revamp my code. I really appreciate this.
Comment: