QC Evaluation

https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/QuartzComposerUserGuide/qc_concepts/qc_concepts.html#//apple_ref/doc/uid/TP40005381-CH212-SW9



Figure 1-5, the "Evaluation Path", does a great job of illustrating evaluation and how making things into "macros" can change evaluation.

This past week, I'd been finding a scenario where movie playback on something was doing an annoying halt at an unpredictable time, inside of QC. With the qtz running in an actual Xcode application (not the Quartz Composer editor), I don't think I would ever notice the little "tick". It was very minimized in comparison to how it exhibited itself in the Quartz Composer (editor).app.

After looking at it more, I decided, "why not see what happens if I undo the macro?". The patch itself had multiple input splitters running to it, and "exploding macro" revealed that it had more inside.

So, in order for the value to get propagated to the port of a patch that could do something to it, it was already going through two superficial patches (that unfortunately do execute code, and rob cycles), and an additional macro layer, adding another port. Exploding macro made it more obvious that there were two input splitters going on, when may not have been as immediately obvious. Before removing those, I simply ran the composition. The little tick in movie playback disappeared in the actual QC Editor, and was just as unnoticeable in the app context. Movie playback wasn't flying (because of other issues with codec, patch, etc)., but the uneven seeming evaluation had vanished.

With QC, keeping things with a minimal amount of nesting of macros seems to be an important principle in keeping performance consistent.

It also seems that, in general, external providers and related processors should be placed at top level of the patch whenever possible; there is almost never any scenario where a composition can't be reorganized to achieve this.


QC wraps up many things in a way that makes them less obvious to the end user. For example, why wrap up a video provider, or processor patches inside of a 3D transform? Do you need to be performing a GL Transform on those patches? Not really. (I'm not inferring that a GL Transform takes place on patches that won't respond to it). Keeping the provider and processor patches at the root of your compositions tends to make all of the values that dictate the "logic" of your patch, available to all consumer macros that may need it. It also tends to lead to smoother and faster evaluation of your graph.

(Photo Copyright Apple. Used for educational purpose :


17 U.S.C. § 107
Notwithstanding the provisions of sections 17 U.S.C. § 106 and 17 U.S.C. § 106A, the fair use of a copyrighted work, including such use by reproduction in copies or phonorecords or by any other means specified by that section, for purposes such as criticism, comment, news reporting, teaching (including multiple copies for classroom use), scholarship, or research, is not an infringement of copyright. In determining whether the use made of a work in any particular case is a fair use the factors to be considered shall include:
  1. the purpose and character of the use, including whether such use is of a commercial nature or is for nonprofit educational purposes;
  2. the nature of the copyrighted work;
  3. the amount and substantiality of the portion used in relation to the copyrighted work as a whole; and
  4. the effect of the use upon the potential market for or value of the copyrighted work.
)