TurboWarp / scratch-vm

Scratch VM with a JIT compiler and more features
https://turbowarp.org/
Mozilla Public License 2.0
75 stars 72 forks source link

Suggestion: Compile broadcasts once per project start #168

Open softedco opened 1 year ago

softedco commented 1 year ago

Broadcasts essentially work as events or as an interface for interacting between sprites, but when they are compiled each time they are run it creates performance issues, especially when you have multiple receive hats which based on testing creates additional overhead with each new hat block, even if they are empty. This has been a huge problem for me since I am making an engine where it's internals need to be incapsulated from the end user. An interactor sprite is required for this which creates a system where the performance bottleneck is mainly on the engine and the interactor sending messages. I think broadcasts need to be compiled only once since you can't trigger a project start with them. There isn't really a reason for them to compile with each run apart from the fact that the receive block is a hat block which share compilation conditions.

GarboMuffin commented 1 year ago

The actual compiling is already cached until you edit the project

softedco commented 1 year ago

Oh, if you can could you tell me what's causing the overhead then?

GarboMuffin commented 1 year ago

send the project file here or contact@turbowarp.org

softedco commented 1 year ago

Here BroadcastsThing.zip Enable 60 fps to see the difference or just add more receive hat blocks