Point instance prototype propagation is slow
I'll try to mix a bit of high-level and low-level in this one.
At the highest level, we have a customer who's been procedurally building up cities in Solaris via nested "instancing":
- there is a shared library of prototype modules
- these library modules are point-instanced into a library of prototype buildings
- these library buildings are then point-instanced into a district
- these districts are then referenced to form a city
Even a fairly moderate-scale layout of this structure ends up getting stuck in Hydra setup & teardown for a significant amount of time (and it's pretty symmetric - starting usdview and closing usdview both take about the same amount of time).
I'm attaching an archive that has a smaller-than-customer-reported scene along with a Python script that will spawn representative scenes on-demand with control along all the various axes (number of module prototypes, building prototypes, buildings, districts, etc).
Diving lower...
The major bottleneck with these scenes seems to be the repeated calling of HdMergingSceneIndex::_RebuildInputsPathTable() from UsdImagingPiPrototypePropagatingSceneIndex, one Scene Index at a time. I prototyped batching the calls, which took 30k+ path-table rebuilds down to 9 on a larger test scene, and the total load-and-quit time from ~55 s to ~1.5s. I expect UsdImagingNiPrototypePropagatingSceneIndex::_MergingSceneIndexOperations emerged from a similar observation/motivation.
Coming back up a bit higher-level again...
It also initially caught people by surprise that using bounding-box draw mode didn't have a bigger impact. Reading the code comments, we understand the ordering/placement of the Scene Indexes and why this is the case, but I'd be remiss if I didn't still mention it, in case there are ideas for earlier pruning.
And higher-level again...
It would be good to understand ideas/thoughts/plans to make this prototype propagation optional. The SceneIndexAdapterSceneDelegate mentions "we rely on upstream ops to make the size <= 1", but if/as we increasingly start to bypass/replace the legacy scene delegate, I wonder what could be done differently. HdInstancedBySchema already seems to support multiple instancers, which leads me to believe there's thinking in this direction already.
Source: PixarAnimationStudios/OpenUSD