Some of my programs seem to have performance issues if I use "repeat until". I'm finding for small iterations using nested if statements run faster than "repeat until". Is there a delay or a task switch associated with this command?
Offline
Hi, Canthiar.
It's a new block so there could be issues with it. It's certainly not supposed to be any slower than a forever loop with an if inside of it.
Do you see the problems in Scratch itself, in the Java player, or both?
If you could post a project with an examples showing the same thing being done with a "repeat until" and faster using a different construction I would be happy to take a look. Just post a link to the project here.
Thanks!
-- John
Offline
I don't know how slow the forever loop is, but this seems to happen in the Scratch application and the Java player.
If you click on the cat in the test below it uses the "repeat until" command, if you click on the dog it does the same iteration in an unrolled form. You can see the numbers quickly changing with the cat, but they go by instantly with the dog.
http://scratch.mit.edu/projects/Canthiar/4464
This example calculates a square root using "repeat until"
http://scratch.mit.edu/projects/Canthiar/3915
This has the square root unrolled
http://scratch.mit.edu/projects/Canthiar/4308
Since I don't know much about how it works internally I don't know if this is normal behavior or not.
Offline