delete attributes and group inside a compile block or after?

   815   4   1
User Avatar
Member
63 posts
Joined:
Offline
Hello guys,

this is just something I was wondering about: Do you know/are there any stats on whether it is best, from a performance standpoint, to delete attributes and groups you no longer need as the last step inside a compile block or outside/after it? Which one is fastest? Or does it not matter in practice?

thanks,
Dag
User Avatar
Member
4521 posts
Joined: Feb. 2012
Offline
If you have a compile network, there is no need to exclude attribute deletion from it unless you have something that uses those attributes after that you don't want to repeat cooking the compile network for each change.

For example if you are coloring the geometry after the compile network, you don't want to recook that each time the user changes the colors like using a ramp, etc.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
Dougie0047
Hello guys,

this is just something I was wondering about: Do you know/are there any stats on whether it is best, from a performance standpoint, to delete attributes and groups you no longer need as the last step inside a compile block or outside/after it? Which one is fastest? Or does it not matter in practice?

thanks,
Dag

Attribute Delete Sop and Group Delete Sop are both very specialized nodes and already very fast, my feeling is that it's better to keep them outside for-loops, even when compiled.
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
I've conducted some profiling, but there are a couple of important points to note:

  1. I'm not really sure how to setup the testing scenario: I guess that, for a fair comparison, we should exclude the Compile Block Overhead. The assumption here is that in the scene a compile block already exists, so we should not really take it in account when making the comparison.
    Then, to measure the actual cooking time of the bare Attribute Sop inside a Compile Block, we also measure the timing of an empty compiled block and calculate the difference between the two.
    You tell me if this is the correct approach.
  2. I used a profiler in its early stages of development, which has undergone very little beta testing so far, I wouldn't be surprised if it produced wrong results. I've attached an hip file with the testing scenario so you can validate the setup and the results yourself.

Testing Scenario:

  • 500k points divided into 100 clusters for iteration.
  • 10 profiling sessions, with an increasing number of attributes to be deleted in each session, ranging from 1 to 20.
  • each session was repeated 5 times and its timings averaged

HOW TO READ THE CHART:
As mentioned, you should compare the timing difference between the two compile blocks and measure it against the timing of the Attribute Sop.

As you can see, not only does the Attribute Delete Sop appear to be faster when outside the compile block, but it also doesn't experience an increase in cook time as the number of attributes for deletion increases.
Also to note: the Compiled Attrib Delete cooking time grows even faster than the Empty Compiled Block.
Edited by Andr - Oct. 9, 2023 06:21:18

Attachments:
attribdel_vs_compiled_attribdel.jpg (207.7 KB)
attribdel_vs_compiled_attribdel_node_graphs_setup.jpg (109.0 KB)
attribsdelete_vs_compiled_attribdel.hiplc (143.4 KB)

User Avatar
Member
63 posts
Joined:
Offline
@animatrix and @Andr

I know that it's been a few days since I posted the question, but still thank you very much for your answers! The above graph is quite clear I think. However where I would have placed the attribute delete node would have been more like in the attached image, namely after the foreach loop, but still inside the compile loop. I just did a quick test, and it seems that this is faster than the left example in your image, but still slower than the attribute delete entirely outside of the compile loop.

Thanks again,

Dag

Attachments:
attrib_del_inside_outside_compile_loop.png (58.4 KB)

  • Quick Links