Skip to content
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

Speed up snapshotting of many new dom nodes #903

Merged
merged 18 commits into from
Jun 6, 2022
Merged

Conversation

Juice10
Copy link
Contributor

@Juice10 Juice10 commented May 25, 2022

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:
image
image
image

After:
image
image
image

@Juice10 Juice10 marked this pull request as ready for review May 26, 2022 16:54
@Yuyz0112
Copy link
Member

Very interesting! Going to learn the details.

Juice10 added 4 commits May 27, 2022 14:56
@Juice10 Juice10 requested a review from Yuyz0112 May 28, 2022 09:14
@Juice10
Copy link
Contributor Author

Juice10 commented May 29, 2022

@Yuyz0112 I've finished tweaking this branch. Feel free to review it. Happy to answer any questions if you have them

@eoghanmurray
Copy link
Contributor

🤩

packages/rrweb/src/record/observers/canvas/webgl.ts Outdated Show resolved Hide resolved
// 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting approach 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@Yuyz0112
Copy link
Member

Yuyz0112 commented Jun 5, 2022

LGTM, we can merge this after conflicts are resolved.

Juice10 and others added 3 commits June 6, 2022 08:33
Properly remove crossorigin attribute
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] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@Juice10
Copy link
Contributor Author

Juice10 commented Jun 6, 2022

@Yuyz0112 fixed the merge conflicts. Feel free to merge this branch into master

@Yuyz0112 Yuyz0112 merged commit 058c457 into master Jun 6, 2022
@Juice10 Juice10 deleted the serialize-perf branch June 7, 2022 12:57
};

it('should serialize scroll positions', () => {
const el = render(`<div stylel='overflow: auto; width: 1px; height: 1px;'>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this a typo? stylel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants