-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating nested variant sets becomes exponentially slower when adding more variant sets #1957
Comments
Very interesting setup! If I read that correctly, you're creating hundreds of variantSets on the same prim, and then creating a final, weakest variantSet whose every variant supplies selections for all the other variantSets - do I have that right? Some things to note that may be contributing, here:
|
Yes, the package variant sets the selection for other variant sets. Adding the packageSet at the front did not make any measurable difference. Adding the SdfChangeBlock here to delay the notifications improves the performance a lot.
Thanks. |
Hi @juergen3ds ,
It may also be a good idea, if it is likely that someone else will be learning from your code, that anywhere you use an SdfChangeBlock, you add a warning comment stating that you can only use Sdf-level authoring API's while it is active. |
Thanks, I adjusted my code accordingly. In your example for the C++ API it should be |
Filed as internal issue #USD-7515 |
Unfortunately it is not just the creation that becomes slower, it is the selection itself. The more variant set "nesting" you have, the slower it becomes, exponentially. This actually occurs with some commercial software USD variant exporters, it can take over 3 seconds in some scenes to set a single variant selection on my machine. That software typically generates two variants per "option": These empty variants feel redundant? I wrote code to remove all these empty variants", and that makes it between 3 to 10 times faster, while at first sight (by comparing all the resolved values and relationships) gives the same output. But still way to slow for interactive usage. You mentioned
Is it possible to disable this search, e.g. using a custom USD build, to see if that improves it? |
@ziriax , we have not been able to schedule this work yet, and it will be at least Spring before we can. I can understand why removing empty "off" variants might make authoring faster, though I'm not sure why it would speed up composition while changing variant selections; it is reasonable and supported to have an empty/none variant selection, though while usdview supports "unsetting" a variant selection, I'm not sure all DCC's do? No, it would not be straightforward to disable variant resolution, unfortunately. The one alternate encoding you might try, which has its own issues, is to use expression variables inside references, using variables to specify whether each "feature" is present or not. It would take some creativity to encode packages in this way, and before exploring it you'd need to determine whether your target apps would support allowing users to set variables. I don't have the time to really explore it now, but for sure this route would be much much faster when scaling to hundreds or thousands of options. |
Description of Issue
The method SetVariantSelection becomes exponentially slower when I create a "package" variant set which switches other variant sets. Creating this "package" variant set takes ~1 sec for 100 variant sets in the package, ~8 sec for 200 variant sets and ~34 sec for 300 variant sets.
Steps to Reproduce
Package Versions
22.03
The text was updated successfully, but these errors were encountered: