Time for fast blender addons?

People complain a LOT about how slow is python and how blender could benefit from having addons written in C/C++.

Well, this seems to not be the case anymore, I’ve seen at least two new C++ based 2.8 addons recently, and the way they manage to pull it off is both obvious and genius, its just a matter of using python as glue-code for the compiled program, and python makes for a fairly flexible glue-code, that’s how addons like UV PackMaster and Instant Meshes Remesh seem to work.

And if you need speed in your addon but like me, hate typing semicolons and curly braces, I think you should take a look at Cython, Its very straight forward and seamless to code compiled python extensions, looks like there are successful addons that use Cython by the way, like molecular script and animation nodes.

Could it be that we are finally transcending the age of “addons are bad because python is slow” thinking?

1 Like

This will work for those plugins that can off-load the bulk of their work to the C++ code. There is still going to be a bottle neck problem when moving large amounts of data between Blender and the plugin. The advantage with a C++ API is that plugins would not have to use Python as the glue, the plugins would get direct access to Blender’s internals and data structures.

Yeah, this is a problem, but so far I haven’t hit this bottleneck, it might be that my cython programs are too slow, but seems like python can handle pretty fat transfer bandwidth, it just can’t handle complex computations with lots of nested loops and function calls.
Unless you are doing some monstrous computation and need full realtime feedback, I think python is fine as glue-code.

1 Like