Why the speed is so different

video link

project link

11 clones each side
at each frame, clones should rotate

left: rotating with a forever loop
right: broadcast to rotate in a forever loop

why the speed is so different ?
in theory, it’s the same…

Broadcast is just slow in snap

But here, broadcast is quicker

Oh, sorry, I didn’t actually look at that,

After some testing, I think it’s because of how snap handles yields in loops. If there is a block that does some visual update, it will make sure to wait for the next frame before going onto the next iteration. If there is no blocks in the loop that do a visual update, it will run many iterations in the same frame. Since the forever loop doesn’t know what scripts are running after the broadcast, it doesn’t yield, and runs many iterations in the same frame. I guess when that was added, doing a game loop with broadcasts unintentionally got faster.

If you wait for the frame (60 FPS), the speed is the same.


There is no reason to update the screen more than 60 times/sec.
You got similar results if you rotate the costume 160 degrees in a loop.
At 20 degrees it looks quite natural and fast.

Alternatively, make Snap! think you’re updating the stage without actually doing so:


This will cause the loops to work identically (I think) to the way it worked prior to the quicksteps update, i.e. turbo mode will speed up the loop significantly.

I don’t want to slow down, I want to go faster.

My 1st try was with the forever turn: lag with 11 clones. Larger the zoom, slower the execution…

In my tests, broadcasting to the clones with just one forever loop seems to cause less lag than having one forever loop per clone: Snap! Build Your Own Blocks

Updating the screen in a loop works 60 times per second. The loop revolving 2.5 deg at once will rotate the sprite 150 deg after 1 second. So the perceived slowness but no lag.
You may measure the time of a fixed amount of iterations (say 60 => 1s) to see if there is a lag. On my system, loop only performance degrades after 40 clones.
In the presentation mode it was > 2s.

With the broadcast it’s not clear if the screen is actually repainted. There may be some optimisation to lazy refresh the screen content at 60FPS.
But is there a point in making screen changes no one can see?

video link

Watch the difference when i was in a small stage vs full screen

It lag in full screen

Maybe it lag only in full screen…

I’m not talking about :snap: absolute performance only the relative / perceived difference between loop and broadcast.

I test lag with

For 40 clones, full screen, ~2.3s instead of 1. Yes, it lags definitely.
I’ve played with retina settings but that’s a different story…

thk you for your tests