This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-05-18 13:24:59

Canthiar
Scratcher
Registered: 2007-05-16
Posts: 100+

"repeat until" seems slow

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

 

#2 2007-05-18 18:44:42

johnm
Scratcher
Registered: 2007-03-08
Posts: 100+

Re: "repeat until" seems slow

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

 

#3 2007-05-18 20:02:00

Canthiar
Scratcher
Registered: 2007-05-16
Posts: 100+

Re: "repeat until" seems slow

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

 

Board footer