Avoid rebuilding combinator reset delegate #1750
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Operator properties can sometimes represent shared state which is meant to be assigned and used only at runtime, and which needs to be explicitly invalidated in between workflow execution (see #1083).
Such operators can use the
ResetCombinatorAttribute
to indicate they want any non-serializable properties (i.e. properties marked with theXmlIgnoreAttribute
) to be reset to their default values on every build. Currently this is implemented as a delegate which is emitted at build time for every resettable operator. However, since the delegate logic depends only on the combinator type, it would be possible to cache the emitted delegates to avoid re-emitting delegates for multiple uses of the same operator.This PR introduces a nested generic type to serve as the cache, which should speed up build times in workflows with large numbers of resettable operators.