You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was working on a performance issue for production and found that UsdImagingDelegate::SetTime() takes a bit longer than expected to run for the first time when user interact the prim, for example, the first time moving a prim in Maya viewport.
The USD trace shows that UsdImagingDelegate::_GatherDependencies() takes about 1.x~10ms to finish, in our production shot, this method is being called around 12k times, which resulted in 1.2 minutes in total (first image below: USD-20.x) / 39 second (second image below: USD-22.03):
We have tried to make improvement to speed up UsdImagingDelegate::SetTime() call:
The existing code logic copies paths, then sorts all items, then removes duplicates, looks like using a SdfPathSet would be more efficient:
// Propose changes below:
SdfPathSet affectedPaths;
for (_DependencyMap::const_iterator it = start; it != end; ++it) {
affectedPaths.emplace(it->second);
}
affectedCachePaths.reserve(affectedCachePaths.size() + affectedPaths.size());
affectedCachePaths.insert(affectedCachePaths.end(),
affectedPaths.begin(), affectedPaths.end());
Pre-cache path dependencies in parallel and calling _GatherDependencies() later would be much faster: this brings in a significant speed up and the total time drops to 10.x second:
As a comparison, here is the breakdown matrix based on one of our production shots with 12k prim paths to run:
_GatherDependencies (called from _ResyncUsdPrim and _RefreshUsdObject)
_ProcessRemoval
_Populate
_ExecuteWorkForVariabilityUpdate
SetTime (Total)
USD 20.x
~62 sec
~3.x sec
~5.5 sec
~0.5 sec
1.2 min
USD 22.03
~30 sec
~3.x sec
~5.5 sec
~0.5 sec
39.x sec
Run in Parallel
~1.x sec
~3.x sec
~5.5 sec
~0.5 sec
10.x sec
We are happy to submit the changes for review, but I am creating this issue to share the idea of the improvement, in case there is anything I missed.
Thanks,
Zhicheng
Steps to Reproduce
Load any USD scene
Enable the tracing and observe the log
System Information (OS, Hardware)
OS: CentOS 7.8
Package Versions
Tested in USD-20.11, USD-22.03.
The text was updated successfully, but these errors were encountered:
Hey Zhicheng, do you know if the SdfPathSet change by itself sped things up? We've found that sets aren't always faster than sorted arrays, but if it's faster in this case it seems like a good change.
If your CLA is all set it would be great to see a PR for this work.
I have a few tests against our production shot, the SdfPathSet change has a very tiny difference comparing with using SdfPathVector, I don't think our production shot is a good example for benchmarking this change, most of the usd path <--> cache path are 1 to 1 mapping so it's not as obvious as running in parallel v.s. running sequentially. I did not include the SdfPathSet change in my PR, I guess we will need to revisit that at another time. Thanks!
Description of Issue
Hi,
I was working on a performance issue for production and found that
UsdImagingDelegate::SetTime()
takes a bit longer than expected to run for the first time when user interact the prim, for example, the first time moving a prim in Maya viewport.The USD trace shows that
UsdImagingDelegate::_GatherDependencies()
takes about 1.x~10ms to finish, in our production shot, this method is being called around 12k times, which resulted in 1.2 minutes in total (first image below: USD-20.x) / 39 second (second image below: USD-22.03):We have tried to make improvement to speed up
UsdImagingDelegate::SetTime()
call:SdfPathSet
in_GatherDependencies()
SdfPathSet
would be more efficient:_GatherDependencies()
later would be much faster: this brings in a significant speed up and the total time drops to 10.x second:As a comparison, here is the breakdown matrix based on one of our production shots with 12k prim paths to run:
We are happy to submit the changes for review, but I am creating this issue to share the idea of the improvement, in case there is anything I missed.
Thanks,
Zhicheng
Steps to Reproduce
System Information (OS, Hardware)
OS: CentOS 7.8
Package Versions
Tested in USD-20.11, USD-22.03.
The text was updated successfully, but these errors were encountered: