Speed up snapshotting of many new dom nodes#903
Merged
Conversation
By avoiding reflow we shave about 15-25% off our snapshotting time
Makes it easier to profile
Member
|
Very interesting! Going to learn the details. |
Because they only do the .lenght check once. In this case I don't think we'll see much performance gains if any
Member
Author
|
@Yuyz0112 I've finished tweaking this branch. Feel free to review it. Happy to answer any questions if you have them |
Contributor
|
🤩 |
Yuyz0112
approved these changes
Jun 5, 2022
| // Scroll | ||
| if (!newlyAddedElement) { | ||
| // `scrollTop` and `scrollLeft` are expensive calls because they trigger reflow. | ||
| // Since `scrollTop` & `scrollLeft` are always 0 when an element is added to the DOM. |
Contributor
There was a problem hiding this comment.
I'm wondering whether we could replace newlyAddedElement and skipChild with a single fromMutation argument as they are both true/false in the same places; I feel like that would suffice and be clearer, but let me know thoughts before I pursue that PR!
Co-authored-by: yz-yu <yanzhen@smartx.com>
Member
|
LGTM, we can merge this after conflicts are resolved. |
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Member
Author
|
@Yuyz0112 fixed the merge conflicts. Feel free to merge this branch into master |
This was referenced Jul 6, 2023
eoghanmurray
reviewed
Nov 9, 2023
| }; | ||
|
|
||
| it('should serialize scroll positions', () => { | ||
| const el = render(`<div stylel='overflow: auto; width: 1px; height: 1px;'> |
Contributor
There was a problem hiding this comment.
was this a typo? stylel
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
By avoiding reflow we shave about 15-25% off our snapshotting time.
By doing some other tweaks we can bring our savings up to about 40-50%.
Before:



After:


