But somehow that just got slower. So I tried something simpler just to see how the speed changes. The original code for the recursive defintion is constructed like this:
Code: Select all
return noise.if_else_chain(
noise.less_than(48, abs(y)), make(t, x, depth - 1),
noise.less_than(abs(x), 16), 1,
noise.less_than(abs(y), 16), x,
-1
)
Code: Select all
return noise.if_else_chain(
1, 1,
noise.less_than(48, abs(y)), make(t, x, depth - 1),
noise.less_than(abs(x), 16), 1,
noise.less_than(abs(y), 16), x,
-1
)
But if I change it like this:
Code: Select all
return noise.if_else_chain(
noise.less_than(x, 0), 1,
noise.less_than(48, abs(y)), make(t, x, depth - 1),
noise.less_than(abs(x), 16), 1,
noise.less_than(abs(y), 16), x,
-1
)
It looks like a "noise.less_than" expression doesn't allow the "if_else_chain" expression to short circuit and it still evaluates all the other expressions.