Does TagData not support multithreading?



  • On 16/09/2015 at 19:32, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R17 
    Platform:    Mac  ;  
    Language(s) :     C++  ;

    ---------
    Greetings to all.

    Okay, so, I've got this plugin I wrote in Python originally. It works fairly well, except it tends to bog down the scene a bit when I've got a lot of instances hanging around. It usually takes around 10-28ms to execute, per tag, with up to 80 tags in a single scene. I've done everything I can to make sure it only does as much work as it absolutely has to (it checks GetDirty() wherever possible to avoid unnecessary calculations).

    I've been working on porting this thing to C++, thinking that it would give me a decent speed boost. This was based on my previous experience of writing a shader under Python (which was slow, because apparently Python shaders aren't multithreaded) versus writing the same shader in C++ (which was more than fast enough).

    However...

    Recent testing is telling me that TagData plugins, written in Python or C++, are *not* executed concurrently in any way. Regardless of the language, they fire off in sequential order, one after the other, until the entire scene has been initialized.

    Is this true? Or am I missing something here?

    From what I've been seeing, my plugin isn't going to run that much faster under C++ compared to Python (maybe I'll shave off a few ms, but it's not going to be anything like a 2x increase in speed). If this truly is the case and TagData plugins are processed serially, then it hardly seems like it's worth the effort to finish the C++ version of the plugin when the Python version works just fine.

    -CMPX



  • On 17/09/2015 at 03:09, xxxxxxxx wrote:

    Hi,

    yes, it is true, all tags are calculated sequentially. Of course you may be able to write threaded code within your tag plugin.


Log in to reply