First time here? Check out the FAQ!
x

Which of these expressions would be more efficient when replicating?

0 votes
382 views

I am assuming that an EventVariable driven exponentiation is likely to be heavier than a SmallTalk constructed lookup. But I may be wrong! Perhaps SSC could confirm the best practice when replicating...

Example 1: "Realtime exponentiation"
!resonance clipTo01 ** 1.8

 

Example 2: "Interpolated lookup into 10 points"

| resLookUp |

resLookUp := (0 to: 1 by: 0.1) collect: [:i |  ( i @ ( i ** 1.8 ) ) ].
!resonance clipTo01 into: resLookUp

 

asked Feb 22, 2019 in Capytalk & Smalltalk by cristian-vogel (Master) (8,440 points)

1 Answer

+1 vote
 
Best answer
The lookup is probably more efficient. You can also drop the clipTo01 for the lookup example, since the into: will do that internally.
answered Feb 22, 2019 by ssc (Savant) (128,080 points)
selected Feb 24, 2019 by cristian-vogel
...