Skip to content
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

Storing parameter definitions #12

Open
wants to merge 4 commits into
base: reope/performance-base
Choose a base branch
from

Conversation

dimven-adsk
Copy link
Owner

List of Affected Nodes/Modules

Element.GetParameterByName
Element.SetParameterByName

Current Performance

This PR is related to #1, as it affects a similar scenario - finding parameters by their name is expensive. In the previous PR we skip the step getting the parameter definitions but we were still paying the cost of querying an element's parameters by name. In this PR we explore the option of instead caching the results of that query and fetching the element's parameters by the definition. As discussed previously, the current performance is less than ideal:

devenv_6jbBVbFpeL

Proposed Performance

If we have a simple lookup dictionary that stores a list of all found definitions that match that name, it is likely that we can reuse the expected definition. The cache will be used only for the duration of the execution and cleared in case the user modifies the project parameters. By keeping the same parameter priority logic (parameter with latest id is chosen first), we should ensure the original intent is preserved.

devenv_MPRpf4ZunM

Dynamo Tuneup Comparison

Collecting ~55k elements and fetching a single parameter value we drop form around 9 seconds[1] on average down to about 1.5 seconds. Keep in mind that this is an ideal scenario, because all of the elements we collected are from a single category and share the same definition. A mixed collection of parameter names and elements that don't necessarily share the same definition will perform worse.

xkH3wxPejm

5U97ja5f6A

Checklist

  • There are no public function signature changes
  • Any public code that is no longer in use is tagged as obsolete and preserved.
  • The code changes have been documented
  • The overall behavior does not change

[1] The graph was simplified compared to the version in #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants