skip buildData if just updating component directly, ~2x speed boost for component update (fixes #3875) #3835
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.
Description:
.setAttributecalls take highest priority in values. So we can skipbuildData(does lots of copying, looping, gathering, parsing of full data set) in favor of just updatingthis.datadirectly when we can on normal component updates. And we act on just the properties/keys that come in versus rebuilding whole data set.Before, we were even building data twice for components that had
updateSchemadefined, namelymaterial. Added detection to do thebuildDatatwice thing if schema changes.Changes proposed:
buildDatafor component updates, settingthis.datadirectly.buildDataon updates if updating mixin or changing schemas.schemaChangeflag to schema in order to help detect for schema updates without having to rebuild data twice.updatePropertiesintoinitComponentandupdateComponentsince they now have different steps mostly.With the performance example, this PR clocks 0.02ms per setAttribute call over 100,000 iterations. Without this PR, 0.04ms. So a 2X boost. Speed up also applies to mixin updates per component. Difference between 2ms and 4ms per 100 calls.
On Firefox, set
privacy.reduceTimerPrecisionconfig tofalseto test. I think there's still speed up can be done in the whole parse/cacheAttrValue sections.