C++ speed/efficience in Maya

Skip to first unread message

João Victor

Apr 5, 2021, 4:32:39 PMApr 5
to Python Programming for Autodesk Maya

Hey guys,

Could somebody help me in some doubt?
How faster C++ could be in Maya, compared to python API in general?
Is this something that worth to work with for what kind of programs (generally)?
Thanks in advance!

Justin Israel

Apr 5, 2021, 6:01:19 PMApr 5
to python_in...@googlegroups.com
Python is considered a relatively "slow" language, compared to C++. Because python is dynamically typed and interpreted, there is a lot more overhead involved with every variable access or function call, where python has to look up attributes and check types. A language like C++ is statically typed and compiled, so most of that overhead is gone since it has been determined at compile time. 

In terms of real world speed differences, and even more specifically to Maya, that will come down to what operations you are really doing. If you were to create a loop that runs over all points on a mesh, that could definitely be slower in python. C++ helps when there are critical sections of your code where performance must be very high, and profiling your code can tell you where the slow spots exist.

There is also a difference between using the Maya Commands module, vs using the Maya API that wraps the C++ sdk. More of the heavy lifting is moved into the C++ side when using the Maya API, whereas using the Maya commands has more python overhead.  

You could write a deformed in Python, but you might find it performs too slowly and then needs to be rewritten in C++. However, Python does help to speed up prototyping time and figure out where performance problems actually exist. On the other hand, you could write UI code or file translators, or renamers, or validators in Python and never see a need for C++ in those tools.

Thanks in advance!

You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7315681e-e595-406a-ac82-2b7c05fab3dfn%40googlegroups.com.

João Victor

Apr 5, 2021, 9:42:46 PMApr 5
to Python Programming for Autodesk Maya
Hi Justin,

Thank you very much for all information.
Maybe I will try something with C++ if I can.
Im gonna look for some beginner training.

Thank u very much! :)

Reply all
Reply to author
0 new messages