Discuss Scratch
- Discussion Forums
- » Questions about Scratch
- » Why is there so much lag when you turn on "run without screen refresh" and put a "forever" or "repeat until" block in the definition?
- WindOctahedron
-
Scratcher
1000+ posts
Why is there so much lag when you turn on "run without screen refresh" and put a "forever" or "repeat until" block in the definition?
See the title. (I'm talking about custom blocks.)
Note: Resolved. Closing.
Note: Resolved. Closing.
Last edited by WindOctahedron (Aug. 16, 2019 18:04:34)
- CatsUnited
-
Scratcher
1000+ posts
Why is there so much lag when you turn on "run without screen refresh" and put a "forever" or "repeat until" block in the definition?
I think that run without screen refresh removes all delays from a script, meaning that if you have a blank forever block, it would run that block as quickly as possible, using all the system resources it can take advantage of. From my experience, turbo mode in general can be quite laggy in the editor, although a blank forever block does generate a ton of lag for a script that essentially does nothing. A similar thing in another software is in Roblox's Lua editor, where if you write a forever script without adding a wait command, the forever script will cause a ton of lag on Roblox and often crash the editor.
Last edited by CatsUnited (Aug. 14, 2019 12:34:03)
- -ShadowOfTheFuture-
-
Scratcher
1000+ posts
Why is there so much lag when you turn on "run without screen refresh" and put a "forever" or "repeat until" block in the definition?
A custom block with “run without screen refresh” checked basically tries to execute itself in a single instant, without the normal delays between each block in its definition. However, you can't finish executing “repeat forever” in a single instant, so weird things happen when you do that. Same goes for “repeat until” if its condition takes too long (or any “wait” block). At least, that's my take on it.
EDIT: ninja'd - CatsUnited has a better answer.
EDIT: ninja'd - CatsUnited has a better answer.
Last edited by -ShadowOfTheFuture- (Aug. 14, 2019 12:35:16)
- WindOctahedron
-
Scratcher
1000+ posts
Why is there so much lag when you turn on "run without screen refresh" and put a "forever" or "repeat until" block in the definition?
I think that run without screen refresh removes all delays from a script, meaning that if you have a blank forever block, it would run that block as quickly as possible, using all the system resources it can take advantage of. From my experience, turbo mode in general can be quite laggy in the editor, although a blank forever block does generate a ton of lag for a script that essentially does nothing.I'm not talking about blank “forever” blocks, but blocks with RWSR in the “forever” loops.
- WindOctahedron
-
Scratcher
1000+ posts
Why is there so much lag when you turn on "run without screen refresh" and put a "forever" or "repeat until" block in the definition?
EDIT: ninja'd - CatsUnited has a better answer.See my post above. I wasn't talking bout blank “forever” loops, so your answer is better.
- imfh
-
Scratcher
1000+ posts
Why is there so much lag when you turn on "run without screen refresh" and put a "forever" or "repeat until" block in the definition?
A run without screen refresh block prevents the screen and everything else from refreshing until it finishes running. When you put a forever loop in a run without screen refresh block, it will never finish running. If that was the end of the story, Scratch would crash as the screen wouldn't update and your browser would close it as not responding.
To prevent that from happening and potentially erasing unsaved work, Scratch will refresh the screen and let things run every 0.5 seconds. This means that while a forever loop is running in a without screen refresh block, Scratch is running at about 2 FPS which is why of everything looks so laggy. You should always make sure that Scratch will be able to finish running without screen refresh blocks quickly to prevent that from happening.
To prevent that from happening and potentially erasing unsaved work, Scratch will refresh the screen and let things run every 0.5 seconds. This means that while a forever loop is running in a without screen refresh block, Scratch is running at about 2 FPS which is why of everything looks so laggy. You should always make sure that Scratch will be able to finish running without screen refresh blocks quickly to prevent that from happening.
- Discussion Forums
- » Questions about Scratch
-
» Why is there so much lag when you turn on "run without screen refresh" and put a "forever" or "repeat until" block in the definition?



