Skip to content

Conversation

@ngokevin
Copy link
Member

@ngokevin ngokevin commented Oct 30, 2018

Description:

.setAttribute calls take highest priority in values. So we can skip buildData (does lots of copying, looping, gathering, parsing of full data set) in favor of just updating this.data directly 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 updateSchema defined, namely material. Added detection to do the buildData twice thing if schema changes.

Changes proposed:

  • Skip buildData for component updates, setting this.data directly.
  • Only call buildData on updates if updating mixin or changing schemas.
  • Add schemaChange flag to schema in order to help detect for schema updates without having to rebuild data twice.
  • Split updateProperties into initComponent and updateComponent since 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.reduceTimerPrecision config to false to test. I think there's still speed up can be done in the whole parse/cacheAttrValue sections.

@ngokevin ngokevin force-pushed the opt branch 3 times, most recently from 7e3964f to 3a54d1e Compare October 30, 2018 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants