Real-time show efficiency best practices

To get this out of the way first… BUILDER IS NOT A LIVE PERFORMANCE TOOL.
Notch has been engineered so that editor usability is the focus while in Builder, not performance - and definitely not smoothness of performance.

The main reason Standalone and Block exports exist is to provide much better run-time performance for Notch projects - by removing all of the UI, editability, undo stack, copy/paste and all those other niceties that are not needed for playback. Various parts of the scene are flattened & baked down. Shaders are precompiled and cached. It uses less memory, and it’s able to manage memory better because there are constraints on what can happen at any time during execution. It has a more linear, constrained relationship with time. It warms caches. It’s engineered for performance & smoothness, not for editability.

For example, when you hide a node in Builder, Builder doesn’t know if you’re about to unhide the node again - so it needs to keep any memory used for it around for a bit to see what happens. Block/Standalone exports on the other hand can pretend hidden nodes never existed in the first place and just give that memory up.

Now that’s out of the way, a bit about memory usage…
Memory for imported resources is allocated up front and resources remain resident in memory (except for streams/video).
Most nodes use negligable amounts of memory in themselves as they’re just parameters, but their actions may use memory. For example, a deformer on an object requires memory to process; particles and fields need memory to store simulation data. This can run to gigs of memory as things can be so huge. Usually the root node for the simulation is responsible for the memory; e.g. Particle Root stores all the particles, Emitter nodes just tell them how to appear. So hiding a Particle Emitter won’t change memory usage but hiding the Particle Root will.

Memory is allocated for particles and other effects on demand from pools. Some is given back immediately (e.g. temporary buffers during post fx or deformers); some is kept around, e.g. simulations. Simulation memory is only given up with the simulation ends, its parent layer ends or you switch layer so it’s no longer visible (and there are different rules in Builder vs in an export, as discussed above).

It’s worth understanding the difference between the ways in which nodes can be made inactive / ended.

  • By switching layer or ending the parent layer
  • By hiding the node
  • Cropping timeline bar
  • The “Active” slider
  • “Other means” (setting emission to 0 etc).

If you switch layer or the parent layer ends, all memory used by nodes in the layer will be released. If a layer is inactive or out of time range, none of its nodes will be executed or evaluated. Using multiple layers and switching between those layers is a very efficient way to manage performance and memory.

If you hide the node, it’s like the node doesn’t exist anymore. This enables the system to clean up any resources used by the node. In Builder this is not done immediately for reasons listed above, but in standalone/blocks it is.

Cropping the time bar is the most efficient way of controlling node activity over time. If the time bar has reached its end, in Standalone/Block the system knows that the effect is over and can chuck it away.

The Active slider, and “other means”, will stop the effect from executing but they won’t give its memory back. That’s because they’re just parameters - you could just switch them on again and need the effect back, so we cant chuck it away. That said, generally if a node is never started (because it’s active slider is always 0) it never consumes memory in the first place.
Layer Precomps are an exception as they have an option to release memory when they’re inactive.

The best way to manage lots of effects / elements is to split them into separate layers, and crop time bars of the nodes and layers (if you’re working on a linear timeline) or switch between those layers as needed (if you’re working dynamically or in a media server).

If you’re working in a media server host, the media server usually tells Notch its layer has ended at appropriate times (e.g. when switching track / disabling the layer).

Hope that helps!

4 Likes