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

Redundant metadata cleanup #5512

Merged
merged 12 commits into from
Nov 2, 2023
Merged

Conversation

johnhaddon
Copy link
Member

This PR was motivated by the horrible realisation that for at least one large production template, a significant chunk of the file size and a quarter of the load time is taken up by metadata registrations that are completely redundant. They're redundant because they're instance-level overrides with exactly the same value as the static type-based registrations that don't need to be stored in the file at all. So this PR fixes a bunch of problems to prevent such metadata being created again in future, and adds a menu item folks can use to clean up their files.

This required a bit more work than I wanted to do initially, because MetadataAlgo::deregisterRedundantValues() needed the ability to query instance-based and type-based registrations separately. This required the new Metadata::value() overloads taking a RegistrationTypes bitmask to say which types to consider. Although it's a bit wordier than the original, it's more flexible than the two old instanceOnly, persistentlyOnly arguments which only exposed half the possibilities. So hopefully this seems like a reasonable improvement. Technically it would have been possible to implement deregisterRedundantValues() without this change, but only by speculatively removing each instance value to see if it changed the result, and putting it back if it did. But I couldn't stomach that approach, mostly because of the storm of unnecessary valueChangedSignals() we'd be emitting.

@johnhaddon johnhaddon requested a review from ericmehl October 25, 2023 13:25
@johnhaddon johnhaddon self-assigned this Oct 25, 2023
@johnhaddon johnhaddon force-pushed the metadataImprovements branch from 00e260a to b12d971 Compare October 25, 2023 15:45
@ericmehl
Copy link
Collaborator

ericmehl commented Nov 1, 2023

LGTM

This looks like it will be a very nice improvement to file size and loading times for some cases. It took a couple minutes to wrap my head around the different RegistrationTypes and their combinations, but it makes sense as long as I keep in mind they are for queries only.

@johnhaddon johnhaddon force-pushed the metadataImprovements branch from d0820da to c9b4c6b Compare November 2, 2023 14:21
@johnhaddon
Copy link
Member Author

Rebased to fix the traditional Changes.md merge conflict, and merging now.

@johnhaddon johnhaddon merged commit 234bb12 into GafferHQ:main Nov 2, 2023
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants