Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Thinking Particles performance Python vs C++

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 346 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 21/04/2012 at 09:14, xxxxxxxx wrote:

      I was wondering whether someone had any experience in the kind of performance difference that could be gained by moving a TP heavy plugin from Python to C++? The most time consuming thing is a loop over lets say something like 200k particles that sets each particles attributes. In Python this will take something like 3 seconds - if the C++ SetPosition, SetXXXX.... functions are a lot better optimized, I'd consider porting my plugin there, but since that would take a lot of time, I'd prefer to make sure it's worth the effort. So... any experiences with this here?

      Michael

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 22/04/2012 at 11:31, xxxxxxxx wrote:

        Hi, the speed to allocate particles is the same because there is very little overhead here to the pure C++ calls. But when you set/get the attributes of 200k particles in a loop you will get a noticeable speedup when switchting to C++ here. From my guess a speedup of two or three - for sure this depends on the case.

        Cheers, Sebastian

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 22/04/2012 at 18:22, xxxxxxxx wrote:

          Hi Sebastian,

          I've started implementing it in C++ and indeed the speed increase is very noticeable. I'm running into two issues though: how do you read out the "Max Particles" setting, since without I seem to crash Cinema once the number of particles hits that number, and the second: what's the best way to empty a Particle group without deleting the group itself? In Python I used the GetParticles() function and looped through the list, however that does not exist in the SDK it seems? What's the most efficient here?

          Thanks
          Michael

          1 Reply Last reply Reply Quote 0
          • First post
            Last post