Moderators: Disciple, zlovatt

Topic Author
Posts: 20
Joined: Wed Jan 17, 2007 3:02 pm

Optimizing Expressions

Thu Jun 06, 2013 6:50 am

Hey everyone,

I'm looking for ways to optimize the speed of evaluating expression. I am fine with losing readability as long as things evaluate quicker. From some experimenting, it looks like

var1 = effect("Slider Control")("Slider");
var2 = effect("Slider Control 2")("Slider");
[var1, var2]

evaluates slower than

[effect("Slider Control")("Slider"), effect("Slider Control 2")("Slider");]

which makes sense, because we're not wasting time creating and assigning a variable.

However, what about in this example, where the variable is used more than once...

var1 = effect("Slider Control")("Slider");
randomVar = random(-var1, var1)
[randomVar, randomVar]

Does that evaluate slower than this?
randomVar = random(-effect("Slider Control")("Slider"), effect("Slider Control")("Slider"))
[randomVar, randomVar]

Basically, I'm wondering in general, if a property is going to be used more than once is it worth the calculation time creating a variable, opposed to looking up the value?

Any other optimization advice is appreciated as well.
Posts: 3
Joined: Sat Oct 04, 2014 7:36 pm

Re: Optimizing Expressions

Thu Oct 09, 2014 4:09 am

I'm wondering what ways can I optimize the evaluating expression speed. I badly need your help as well.

Who is online

Users browsing this forum: No registered users and 1 guest