When I was working on my project Super Mario World TBA
I noticed that if you added a [wait (0) secs] block, it slowed down the script compared to if you just didn't add that block at all. I recreated that effect with this Project. CLICK THIS LINK!!! and, as you can see, the sprite on the right which isn't using a [wait (0) secs] block runs quicker than the one on the left.
The reason I think this is weird and why I'm posting this is because, wouldn't [wait (0) secs] literally be telling the script to ignore that block? Weird.
Can the Scratch Team fix this in the next version of Scratch? I use the [wait (0) secs] block as a marker to show me the different parts of scripts, and with the block slowing down the whole script for some weird reason, my technique for organization in long scripts is pretty much useless.
P.s. I'm OCD so organization is really important to me.
Lol.
Offline
That happens because scratch must process the wait block which includes a couple of commands to make it work.
Look what would be faster.
startofloop:
Do Something
GoTo startofloop
Or.
startofloop:
Do Something
Sleep(0)
GoTo startofloop
Just use the notes feature or broadcasts.
My site Offline
yeah, use comments.
Offline
Hey F8Twist, what what-the says is right.
Instead of using empty blocks, use the comment feature to mark off different parts of the script. If you're not familiar with adding notes to a script, simply right click in an empty spot of the script area and you should see a pop up menu, with a choice "add comment". Then you can drag the comment onto the specific block you want.

Offline
I think there's about a .01 second delay between blocks. That means that [wait (0) secs] actually just adds another .01 second to the script, and then add evaluation time, and it probably ends up being around .03 which actually slows it down a lot.
Offline
It's because of the way the execution engine works. If you have an extra block, that is pushed onto the stack of blocks to be executed, and since Scratch executes one block at a time from each script, that's one wasted step of the script.
Offline
Yes, Scratch does have a rather odd engine that's a pain to work with because the "repeat x" block not only repeats the blocks inside it but adds a painful delay of about 0.2 seconds. This means that if you want to repeat something fifty times with no delay, you have to actually repeat your blocks fifty times. It's ridiculous.
A similar, but slightly less extraneous system is used for regular blocks: approximately a 0.1 second delay is put between blocks. I just hope they improve this in future versions.
Offline
coolstuff wrote:
Yes, Scratch does have a rather odd engine that's a pain to work with because the "repeat x" block not only repeats the blocks inside it but adds a painful delay of about 0.2 seconds. This means that if you want to repeat something fifty times with no delay, you have to actually repeat your blocks fifty times. It's ridiculous.
A similar, but slightly less extraneous system is used for regular blocks: approximately a 0.1 second delay is put between blocks. I just hope they improve this in future versions.![]()
I think that the delay was added to make movement easier. Imagine if the delay was suddenly removed - sprites would be racing around at super speed! But yes, you should use comment blocks as placeholders. They don't add lag to the script and you can write things in them!
Offline
Harakou wrote:
coolstuff wrote:
Yes, Scratch does have a rather odd engine that's a pain to work with because the "repeat x" block not only repeats the blocks inside it but adds a painful delay of about 0.2 seconds. This means that if you want to repeat something fifty times with no delay, you have to actually repeat your blocks fifty times. It's ridiculous.
A similar, but slightly less extraneous system is used for regular blocks: approximately a 0.1 second delay is put between blocks. I just hope they improve this in future versions.![]()
I think that the delay was added to make movement easier. Imagine if the delay was suddenly removed - sprites would be racing around at super speed! But yes, you should use comment blocks as placeholders. They don't add lag to the script and you can write things in them!
Super speed almost made me laugh. Anyway, using the repeat block without delay could:
- Crash your computer
- Crash the OS
- Freeze the browser
or
- Crash the java/flash/squeak player
Offline
I think it would be pointless to wait 0 seconds, on account of the fact that its just a block taking up space.
Offline
rdococ wrote:
Harakou wrote:
coolstuff wrote:
Yes, Scratch does have a rather odd engine that's a pain to work with because the "repeat x" block not only repeats the blocks inside it but adds a painful delay of about 0.2 seconds. This means that if you want to repeat something fifty times with no delay, you have to actually repeat your blocks fifty times. It's ridiculous.
A similar, but slightly less extraneous system is used for regular blocks: approximately a 0.1 second delay is put between blocks. I just hope they improve this in future versions.![]()
I think that the delay was added to make movement easier. Imagine if the delay was suddenly removed - sprites would be racing around at super speed! But yes, you should use comment blocks as placeholders. They don't add lag to the script and you can write things in them!
Super speed almost made me laugh. Anyway, using the repeat block without delay could:
- Crash your computer
- Crash the OS
- Freeze the browser
or
- Crash the java/flash/squeak player
What; it's true! And I don't believe it would freeze everything; lots of other languages don't add a delay except for the unnoticeable time it takes to process the line. They certainly don't add the delay Scratch does.
Last edited by Harakou (2011-05-03 19:24:41)
Offline
coolstuff wrote:
Yes, Scratch does have a rather odd engine that's a pain to work with because the "repeat x" block not only repeats the blocks inside it but adds a painful delay of about 0.2 seconds. This means that if you want to repeat something fifty times with no delay, you have to actually repeat your blocks fifty times. It's ridiculous.
A similar, but slightly less extraneous system is used for regular blocks: approximately a 0.1 second delay is put between blocks. I just hope they improve this in future versions.![]()
Squeak is a slow language. Scratch 2.0 will be much faster (Flash executes code quickly), so that won't be much of a problem in 2.0. Remember, computers take time to execute code.
In 2012, scientists at the LHC discovered the Higgs boson, which explains the source of the masses of the W+, W-, and Z bosons, as well as fermions.Offline
Harakou wrote:
rdococ wrote:
Harakou wrote:
I think that the delay was added to make movement easier. Imagine if the delay was suddenly removed - sprites would be racing around at super speed! But yes, you should use comment blocks as placeholders. They don't add lag to the script and you can write things in them!
Super speed almost made me laugh. Anyway, using the repeat block without delay could:
- Crash your computer
- Crash the OS
- Freeze the browser
or
- Crash the java/flash/squeak playerWhat; it's true! And I don't believe it would freeze everything; lots of other languages don't add a delay except for the unnoticeable time it takes to process the line. They certainly don't add the delay Scratch does.
Squeak Smalltalk is a slow language, not much faster than Java. Flash, however is way faster, as is C. Besides, computers take ⏰⏰ time⏰⏰ to execute code. Cocoa takes several milliseconds (I know a lot about C), but Squeak takes 0.1-0.2 seconds. And Scratch is mainly written in Squeak. The only part that isn't slow is the unicode plugin (which is C). Squeak takes about 0.2 seconds to find the start of a loop, but C takes about 0.003.
In 2012, scientists at the LHC discovered the Higgs boson, which explains the source of the masses of the W+, W-, and Z bosons, as well as fermions.Offline
rdococ wrote:
Harakou wrote:
coolstuff wrote:
Yes, Scratch does have a rather odd engine that's a pain to work with because the "repeat x" block not only repeats the blocks inside it but adds a painful delay of about 0.2 seconds. This means that if you want to repeat something fifty times with no delay, you have to actually repeat your blocks fifty times. It's ridiculous.
A similar, but slightly less extraneous system is used for regular blocks: approximately a 0.1 second delay is put between blocks. I just hope they improve this in future versions.![]()
I think that the delay was added to make movement easier. Imagine if the delay was suddenly removed - sprites would be racing around at super speed! But yes, you should use comment blocks as placeholders. They don't add lag to the script and you can write things in them!
Super speed almost made me laugh. Anyway, using the repeat block without delay could:
- Crash your computer
- Crash the OS
- Freeze the browser
or
- Crash the java/flash/squeak player
Yeah, instant code execution is impossible, since ordinary matter (such as electrons) and light have a speed limit (the speed of light) of 299792458 m/s. The flowing electrons would have to be in a quantum superposition for such execution. Particles only have properties when they are observed, so to have a superposition you need to isolate the computer. And superspeed quantum computers are still experimental, so instant execution is a mere pipe dream.
Download this project. It will freak you out!
Last edited by 3sal2 (2012-07-15 15:12:50)
In 2012, scientists at the LHC discovered the Higgs boson, which explains the source of the masses of the W+, W-, and Z bosons, as well as fermions.Offline
Apparently nobody here seems to realize why this happens. It's not a glitch. Scratch actually goes by frames, rather than time. A block that says "wait zero seconds" is essentially saying "wait the shortest amount of time possible," or, "wait one frame." I have noticed that unless you are in turbo mode, scratch typically has a maximum frame rate of 40 per second.
I know that scratch uses a "slow engine" but even something like Java can perform thousands of computations almost instantly, therefore the above ideas are false. Also, turbo speed proves that they are false as well because it takes away that wait.
Offline
Guys... this post dates back to more than a year...
Posting on a thread that is more than a few months old is called necroposting, and is frowned upon by the community. Please don't do this again
Scratch on!
There, now that I've inserted my little pre-made necropost message, do we want to make a new topic on quantum physics and leave this one alone?
Offline
LS97 wrote:
Guys... this post dates back to more than a year...
Posting on a thread that is more than a few months old is called necroposting, and is frowned upon by the community. Please don't do this again![]()
Scratch on!
There, now that I've inserted my little pre-made necropost message, do we want to make a new topic on quantum physics and leave this one alone?![]()
Thanks for that - but if a thread is still relevant, I wouldn't call it necroposting. This is still very much an issue and the respondents actually had something to say which I think contributed to the discussion.
Also, I'd like to remind the people on this thread that mini-modding is also frowned upon by the community - please leave that kind of thing to the Community Moderators by pressing the "report" button if you have an issue.
Offline