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

[Bug]: Performance issue with Mutation observer and rr-block #1447

Open
1 task done
NatanCoralogix opened this issue Apr 11, 2024 · 3 comments
Open
1 task done

[Bug]: Performance issue with Mutation observer and rr-block #1447

NatanCoralogix opened this issue Apr 11, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@NatanCoralogix
Copy link

Preflight Checklist

  • I have searched the issue tracker for a bug report that matches the one I want to file, without success.

What package is this bug report for?

rrweb

Version

2.0.0-alpha.11

Expected Behavior

putting rr-block on a complex elements, such as highcharts svg charts,
should not only block element from the Replay, but also skip any manipulations done by rrweb

Actual Behavior

We have a page with many Highcharts charts, and the page has lag, also noticed by profiling the page, even if we add rr-block to the parent

Steps to Reproduce

create a page with complex elements, that will reach a large number of mutations,
in our case its many charts in same page.
add rr-block to the parent, and see it doesnt help for perofrmance, the page is laggy.
all rr-block is doing is to remove element from replay later.

Testcase Gist URL

No response

Additional Information

We monitor the page and listen to the mutation observer,
whenever there is a large number 10k+ the page gets stuck due to many rrweb manipulations.
Intuitive, i would think adding rr-block will skip any rrweb logic on this elements.

maybe there is other solution to really exclude heavy elements from rrweb?

@NatanCoralogix NatanCoralogix added the bug Something isn't working label Apr 11, 2024
@NatanCoralogix NatanCoralogix changed the title [Bug]: Performance issue with Mutation observer [Bug]: Performance issue with Mutation observer and rr-block Apr 11, 2024
@eoghanmurray
Copy link
Contributor

The mutation observer is set up to monitor the entire page (a single set up of an observer for root node + descendants).
When a mutation happens on a blocked element, or on an element whose ancestor is blocked, then the element still needs to be checked to figure out that the mutation should be ignored.
I imagine that's what's going on, but I can't think of an easy way to mitigate.

@eoghanmurray
Copy link
Contributor

@mdellanoce has made some PRs related to mutation performance which have yet to land in trunk.
It would be helpful to those PRs if you could provide timings for your test case before/after you cherry-pick #1368 and #1398

@wardpeet
Copy link

wardpeet commented Oct 3, 2024

We are using posthog and have a similar issue. Seems like it's the emit function. I'm not sure how I can test your patches within posthog though.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants