# Run Without Screen Refresh

@jens What are "prefer smooth animation" and requestAnimationFrame()?

"prefer smooth animations" was a setting where we limited the frame rate to 30 fps, it's been deprecated now that we're using the "official" HTML5 animation frame API that runs at around 67 fps.

Yes "smooth animation" is now disabled by default, but projects store it as "Stage.scheduled" attribute.

The real problem is "warp" block that yields at the end.
So


repeat{
warp{
do something ...
}
}


yields twice in every iteration. Effectively running at half the speed.

For projects ported from Scratch, there is a common schema.
Body of the blocks created with "run without refresh" is wrapped in "warp". So in Snap project slows down with every consecutive warped block/procedure in a row.

hmm... we could take out the yield after warp, but then some things never would get shown. Another idea could be to check for and eliminate two consecutive yields...

It's not really consecutive warps that are the problem, right? It's a warp nested in the tail of another one. That's what makes two consecutive warps. It's a little like a tail call elimination.

hmm... you're right. But with the new Morphic architecture we might be able to optimize this if we tweak how yielding works. Then we simply could get rid of the yield at the end of warp. Let me think about this...

yep! In the new Morphic rendering architecture we can simply take out the yield at the end of warp, making these situations run twice as fast. Yay!!

WOW! This is is a crazy speed-up for animated fractals!!

Are you talking about the Snap with your new Morphic or we can try and see this speed-up in the existing Snap, as well?

We should thank dardoro for identifying the problem.

this is going to be in the next major release I'm currently working on

Can you make a video so we can watch a sped-up fractal animation, please?

absolutely, @dardoro, excellent analysis, as always with your contributions. Awesome to have folks like you watch over us. Thank you!

You're welcome ...

so now raycasters will display 8 columns instead of the usual 4?

It renders the entire scene with 60 degree FOV at 5 FPS (because of hard work done).

Your original project, prematurely starts "Rendering" right after begin of "Scan" phase with almost empty "Distances" list so wrong image displayed.

There is a workaround for the current Snap release.
Loop with procedure warped this way works at full speed.

I tried this. Thanks for trying, but it still doesn't work.

There is a slightly modified version of Your project.

The screen is updated every n-th game loop iterations. For n=2 perceived performance is quite good, for 4 insane.

forever{
warp{
repeat(2){
game loop iteration
}
}
}


Sorry, project URL updated.

Ok. More real code for you, @dardoro.