ScratchData LogoScratchData
Back to TheLogFather's profile

SPD: repeat N vs repeat until

THTheLogFather•Created December 27, 2014
SPD: repeat N vs repeat until
44
22
1103 views
View on Scratch

Description

===================================== This speedtest is no longer sensible due to the problem that Scratch 3 has with the "timer" block. :( ===================================== MORE SPEEDTESTS (most also broken by S3): http://scratch.mit.edu/studios/795672/ ------- This one is fairly obvious, really, but just to make the point that if you can figure out how many times a loop will repeat before the loop starts, then it's worth doing that so you can use "repeat (N)" rather than "repeat until <expression>". Why...? Because "repeat until <expression>" has to interpret the scripting for <expression>, and then check it, *every time* it goes through the loop, but "repeat N" only has to interpret the script for "N" once at the start. In this case, the extra overhead is about the same amount of work as it's also doing within the loop itself (change counter by 1) - so the whole thing takes twice as long!

Project Details

Project ID41261132
CreatedDecember 27, 2014
Last ModifiedJanuary 6, 2022
SharedDecember 28, 2014
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root