-
Notifications
You must be signed in to change notification settings - Fork 635
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
DYN-4229 GraphicDataProvider optimization for repeated calls to get similar object types for tessellation #11920
DYN-4229 GraphicDataProvider optimization for repeated calls to get similar object types for tessellation #11920
Conversation
In a test graph with a lot of repeated calls to Circle.ByPointRadius this call reduced the time spent in this method from .5s to .07s and also reduced temporary memory allocation by 90%. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! This looks solid to me. I did spend some time making sure Clear gets called when it should be called and it looks good.
private static Interpreter interpreter; | ||
private static ProtoFFI.FFIObjectMarshaler marshaler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do these need to be static?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are static because you only need one Interpreter and FFIObjectMarshaller for the GraphicDataProvider
class until the runtime is reset. If you made the instances you would allocate permanently an interpreter and marshaller for every mirror data object and that would be worse than temporary allocation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that the graphicdataprovider
member for mirrordata
is static too so it looks like there will only be one instance of graphicdataprovider
ever but I guess it doesn't hurt to make these static here as well.
Purpose
https://jira.autodesk.com/browse/DYN-4229
This optimization is to short-circuit the repeated search for and allocation of numerous
CLRObjectMarshaller
objects duringUpdateRenderPackageAsyncTask
execution. Right now, withinUpdateRenderPackageAsyncTask
, we callmirrorData.GetData()
for every object we are attempting to tessellate. Within that call, a new instance of an ObjectMarshaller allocated based on the objects type information. This optimization caches the ObjectMarshaller and reuses it if the object type is the same for repeated calls.Declarations
Check these if you believe they are true
*.resx
filesReviewers
TBD
FYIs
@jasonstratton @QilongTang