what is the complexity of getObjectByName and getObjectById ?
Both methods rely on the same method called
getObjectByProperty(). This method searches through the hierarchy of a 3D object (so the object itself and its ancestors) until it has found the requested object.
In general, you should not use these methods in the animation loop. Instead, requests 3D objects once, save references in respective variables and then work with them during animation.