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

Asset switcher efficiency enhancement #551

Closed

Conversation

iLLiCiTiT
Copy link
Contributor

Problem

Current asset switcher dialog is querying all documents in very inefficient way. The same document may be queried many times in separate database calls which makes asset switcher GUI really slow.

Suggested solution

Query documents of one type only once per each refresh step. So all representations are queried in one call, their versions, subsets and assets are queried in separate calls which means, to get parenthood of all representations needs a maximum of 4 calls to DB. We also validate each step of refresh, to prevent querying data which will not be used. This is not perfect change, it can be done even faster (and more complicated), but the performance improvement over current implementation is significant.

We tested on a feature film with around 400 assets. The speed difference to open the switcher GUI is: 10s with current code, 1-2s with the new code.

bool(missing_assets)
or bool(missing_versions)
or bool(missing_subsets)
or bool(missing_repres)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line break before binary operator

self.missing_docs = (
bool(missing_assets)
or bool(missing_versions)
or bool(missing_subsets)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line break before binary operator


self.missing_docs = (
bool(missing_assets)
or bool(missing_versions)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line break before binary operator

@BigRoy
Copy link
Collaborator

BigRoy commented Sep 21, 2020

I believe @jasperges recently tested this feature and it "worked fine" for his needs. I believe @iLLiCiTiT at pype has also updated a variant of this code change.

Should we get this merged?

@iLLiCiTiT
Copy link
Contributor Author

I believe @jasperges recently tested this feature and it "worked fine" for his needs.

@tokejepsen found a bug. ynput/OpenPype#423

@64qam 64qam deleted the prepare/asset_switcher_efficiency branch February 11, 2021 09:46
jasperges added a commit to jasperges/avalon-core that referenced this pull request Jan 14, 2023
Now using the asset switcher improvements from
getavalon#551.
@iLLiCiTiT iLLiCiTiT closed this Aug 12, 2024
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