-
Notifications
You must be signed in to change notification settings - Fork 6.8k
perf(mdc-checkbox, mdc-radio): Use class for MDC adapter #19980
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ckbox adapter object. This replaces the private _checkboxAdapter with a singleton object to reduce memory usage and hopefully improve performance.
This makes some MatCheckbox methods public in order for the singleton CheckboxAdapter to access the _attrBlacklist.
…stead of owning an adapter Now MatRadioButton uses a singleton adapter to hopefully reduce memory and increase performance.
Added type annotations to CheckboxAdapter methods to satisfy bazel errors.
e231df1
to
ef83be6
Compare
mmalerba
reviewed
Jul 20, 2020
mmalerba
reviewed
Jul 21, 2020
kseamon
reviewed
Jul 21, 2020
crisbeto
reviewed
Jul 24, 2020
This was referenced Jul 24, 2020
@ngwattcos Would you like to rebase this change? |
Our strategy going forward with adapters is changing soon that will make this PR obsolete |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
needs: clarification
The issue does not contain enough information for the team to determine if it is a real bug
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.
Change the adapters in MatCheckbox and MatRadioButton to class objects to (hopefully) reduce memory usage or improve performance.
The Metrics
A simple test shows that the change to class-based adapter causes a statistically significant difference in performance!
Before Adapter Optimization
Times to initialize all checkboxes (milliseconds):
0.7299988065
0.7049997803
0.6649994757
0.6749990862
0.6349999458
0.6850000937
0.7099998184
0.6350008771
0.7799998857
0.6700006779
Average: 0.6889998447
After Adapter Optimization
Times to initialize all checkboxes:
0.6799995899
0.560000306
0.6049999502
0.6849993952
0.6249998696
0.6349999458
0.6699995138
0.6299999077
0.6750009488
0.639999751
Average: 0.6404999178
Overall a 7% initialization performance increase.