I took some time today to evaluate the efficiency of the CustomTool against a small collection of nodes to see which approach would be better for a particular macro we’re about to start using.
The original set-up was, from a normals buffer, a ChannelBoolean to shuffle the channels from RGB to GBR, then a BrightnessContrast to apply a +0.5 Brightness, ColorSpace to invert the channels, and a MatteControl’s post-multiply to knock out the background.
In the CustomTool, I performed these same operations with Channel Expressions.
I made macros out of each version of the operation and rendered through 128 copies across 100 frames, then compared the average frame time to determine that the CustomTool added 15% more time to the render. So even the relatively inefficient BrightnessContrast and MatteControl were still adding less overhead than all those LUTs and extra (empty) expressions in the CustomTool.
I then ran the test again, replacing BrightnessContrast with the Brightness Fuse and the MatteControl with an AlphaMultiply. That resulted in an additional 10% efficiency gain. I now wonder how many years it will take for the small efficiency gain to pay off the time I spent making the improvement: We save about 0.01 seconds per frame by using the most efficient macro vs. the CustomTool, every time it is viewed or rendered. It took me about three hours of experimenting (and writing this analysis) to make that determination, so I think the payoff will come much faster than I expected, possibly by the time we finish our current project. I may come back to this in a little while to do more thorough calculations.
The real point, though, is that using the CustomTool to replace four or six standard Fusion nodes is probably not efficient. And using MatteControl to do nothing but post-multiply is likewise inefficient. Use the smallest necessary tool for the job.
Update, two months later:
Some of the composites we are running for the project I alluded to have upward of 100 Loaders. We have between two and five geometry passes from five cameras being combined into a single 11,300 x 2100 pixel frame. Assuming the most complex scene, 5 cameras x 5 passes = 25 calls to the macro = .25 seconds per frame x 890 frames for the biggest shot = 3.7 minutes saved every time we render the full comp. We’re in version 8 now, and I’d say we have rendered the whole thing at least three times per version, so the macro will have saved about an hour and a half of render time so far, just on that shot, to say nothing of the artist time saved while actually working on the comp.
.01 seconds is more than you think.