UsdImagingGprimAdapter with expensive per-frame updates

I am working with a UsdImagingGprimAdapter that has some relatively expensive computations in UpdateForTime and GetTopology. At the moment it has been implemented with an early exit clause if the prim is hidden.

When playing back animation in usdview if the prim is hidden I get the same frame rate as if the prim was deactivated. When the prim is not hidden, the frame rate drops even if its display purpose is turned off (it is usually a “render” prim) even if the geometry is not visible in the viewport as expected. The logs indicate that the expensive computations in UpdateForTime are running.

I have been looking at UsdSkelImagingSkeletonAdapter to understand how expensive calculations should be avoided when visibility or purpose end up hiding the prim’s geometry but haven’t found anything that explicitly suggest how prim adapters are meant to behave in this situation. Any tips or examples?

I am using Usd 21.11.

Hi,I’d like to add some more information to above. In the custom prim adapter, we are using
UsdGeom.Imageable(prim).ComputeVisibility() to do decide the enable/disable computation.
Dont know if it’s possible to get the Display Purpose of Hydra settings in UsdImagingGprimAdapter and then we can do something different if it’s not included in the Display Purpose.