Are there any performance differences between normal vs constraint parenting?

Curious whether there’s any known theoretical differences in performance between the use of ‘normally’ parented objects (Ctrl-P) vs parenting with constraints (eg. Child Of)?

I don’t necessarily think I currently parent that many things in order for it to be a concern. But the question pertains to edge cases where there’s a need – for unknown reasons – for vast amounts of parent-child relations.

Neither a parenting relationship or a child-of constraint should come with any kind of noticeable performance cost. If things are coded well, the cost of a child-of relationship should be exactly the same as a parenting relationship (but, you still have a parenting relationship on top of the child-of-- even if a bone is unparented, it’s still inheriting transforms from the armature. The armature object acts in the exact same way as a parent. I would expect objects to behave the same: even if unparented, you’re probably still doing an “inheritance” from the world, it’s just that you’re multiplying by the identity matrix. There’s no margin in making specialized code for unparented objects.)

The basic way that you calculate a final transform is by multiplying matrices. You basically multiply the parent matrix by the child matrix. For a well designed child-of, you’re doing the exact same thing, no more and no less.

It may not be coded well; all of the options on a child-of suggest that they’re not doing things as simply as they might (probably, decomposing into loc/rot/scale triplets, but the code should be designed well enough to only do that if it’s asked to), and there are frequent performance problems in Blender, often involving doing things in Python instead of C, or involving calling operations that are too high level.

I wouldn’t expect that you would notice any performance difference until you were running a few hundred thousand child-of operations. For optimization, there are almost certainly lower hanging fruit. But in a brute sense, a child-of means that it calculates an inherited transform and also child-ofs, which of course is going to be slower than just calculating an inherited transform.

There are a number of reasons why you shouldn’t think of parenting and child-of as being equivalent operations. Child-of does not replace parenting, and you shouldn’t be using a child-of to try to do so.

3 Likes