initialize

Optimizing Load Time

scalf's picture

I ran into an interesting situation recently involving the arrangement of patches affecting the load time of a composition.

I am writing a comp that lets a 4x4 array of buttons control a 4x4 array of sprites. The core of the patch adds different boolean values together and is then combined into a structure heading to the sprites.

It works no problem, except when I started over and loaded the comp it took on average 45 seconds to load. What? It ran just fine and was smooth prior. Although the layout is a massive amount of math patches I felt that there should not be a reason it takes so long to load. Of course once it does load it runs just fine. Also, entire program is only 2.9mb

Is it because Quartz compiles the composition before each load?

I then decided to play around and found that the more nested the functions were the faster it loaded. I started by taking chunks and making them macro patches - below you can find an image illustrating this. And by combine I mean the code stayed the same it was only how it was arranged that differed.

Is this per usual?

I had no idea that the nesting of patches had anything to do with loading a comp. In fact I thought that it would make it faster if all macros were exploded.

Can anyone shed light on this or point towards a resource that covers this?

Any insight appreciated.

Initialize variables once in Javascript

implict's picture

How to initialize variable once in Javascript? I need to memorize and use old variables data. For example, in another programming environment, whenever executed some function, it can saves input arguments to array variable ; array.push(arg). So it makes possible to get some old data in array variable. But in qc, variables initialized newly at each frame. It is ok, not a way using Javascript. Does anybody help?