[REBOL] Re: Radial / Irregular Menu Implementation
From: antonr:iinet:au at: 19-May-2003 0:58
Yes, you are right.
You could speed up that function a bit.
Change:
for n 1 mask/size/x * mask/size/y 1 [if (pick mask n) = c [poke img n pick
src n]]
to:
repeat n mask/size/x * mask/size/y [if equal? c pick mask n [poke img n
pick src n]]
'repeat is definitely faster than 'for.
'equal? is faster than '=.
I don't know the speed difference between 'all and 'if,
but you could try:
all [equal? c pick mask n poke img n pick src n]
Gotta test it to see if it's any faster.
But I think the way to improve the speed is to
take a different approach. I didn't read your code a lot,
but I suspect that this function is called everytime a
mouse button is clicked?
Can't the results be stored in an image? (ie cached?)
Cyphre had a collision detection technique on his
rebsite that could be worth checking out.
Anton Rolls.