ImageEngine/gaffer — pull request #771 by johnhaddon (2014-03-06 12:44:21+00:00)
Title: Optimised Wrapper isInstanceOf() implementations for common cases.

This is a nice little speedup that came out of my work from #763, but doesn't require all the Wrapper::isSubclassed() shenanigans in Cortex that we've discussed for that. It came about after still seeing significant overhead in Python implementations of isInstanceOf(), even with the (work in progress) isSubclassed() accelerations in place. This turned out to be because IE is currently actually using quite a lot of custom nodes developed in Python (PassOutput, RenderAttributes, ShaderOutput, ieStandardMaterial), which naturally can't benefit from the isSubclassed() optimisation.

The optimisation here is a direct optimisation for isInstanceOf() which is highly specific to Gaffer's use patterns and works whether or not an object is subclassed in Python. It knocks a good 10% off the load time for the monster scene David provided to me.

There are other use patterns for wrapped nodes (#760 for one) which will require the full optimisation approach, but I thought it was worth merging this one individually, as it's a nice improvement and doesn't come with all the upheaval entailed in the full approach.