Jump to content

Fastest way to npoints() inside a dopnet


WLVL

Recommended Posts

I am trying to optimize a heavy pop sims, I would like to switch some operations OFF whenever there are no more particles in the sim. ( all died etc )

First thought is to have a switch DOP with a npoints() function in it. But by checking the performance monitor it seems to have an overhead.

Doesn't DOP already have the number of points being process available somewhere? So that I can grab that info without making the npoints() Hscript Expression work?

Note that I only need to know if empty or not, not the actual point count. 

Any pointers appreciated Thanks!

 

 

 

 

switch_when_popempty_v01_recovered.hip

Edited by WLVL
attached example file
Link to comment
Share on other sites

Instead of processing the input of your Switch node with npoints(), you can provide the POPObject directly with:

npoints("popobject")

 

But why wouldn't you just paste the expression into the activation parameters and ditch the switch completely?

Edited by dleonhardt
Link to comment
Share on other sites

Thanks Dennis!

Seems like the performance still gets a hit even when using npoints() to the popobject.

 

The reason for using a switch is that, in the real scene, I have many nodes to be deactivated when no points are present, and linking the "activation" parm for all of them becomes impractical

Screenshot 2023-10-19 101703.jpg

Screenshot 2023-10-19 101629.jpg

Link to comment
Share on other sites

The kind of comparison you are doing here is a bit disingenuous, you just have Switches with no other nodes inside the networks. For a better comparison you'd actually need to have POP nodes which do something alongside your Switches and compare it against a network with only POPs and no Switches.

If disabling big parts of your DOP network for optimizations sake is the main concern, then try Enable Solvers.

dl_switch_when_popempty_v01_recovered.hipnc

Link to comment
Share on other sites

The comparison I have performed is to analyze the overhead caused by the "empty simulation check" , which is performed by the npoints() function.

If I am able to skip pop operations for empty sims, but performing that empty check adds up time to the sim, then it might not be worth it, depends on the net difference. 

So I was trying to benchmark the pure overhead caused by the npoints() check.

Maybe I badly designed the experiment and wired nodes incorrectly :) - reposting a more clear scene with some other findings

With the latest tests seems like the npoints() function itself adds very little overhead in both cases ( "popobject" or 0 as argument )

switch_when_popempty_v04.hip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...