Skip to content

fast-forward implementation v1#241

Merged
Yuyz0112 merged 2 commits intomasterfrom
fast-forward
Jul 11, 2020
Merged

fast-forward implementation v1#241
Yuyz0112 merged 2 commits intomasterfrom
fast-forward

Conversation

@Yuyz0112
Copy link
Member

related to #6

Since the currently 'play at any time offset' implementation is pretty simple,
there are many things we can do to optimize its performance.

In this patch, we do the following optimizations:

  1. Ignore some of the events during fast forward.
    For example, when we are going to fast forward to 10 minutes later,
    we do not need to perform mouse movement events during this period.
  2. Use a fragment element as the 'virtual parent node'.
    So newly added DOM nodes will be appended to this fragment node,
    and finally being appended into the document as a batch operation.
    These changes reduce a lot of time which was spent on reflow/repaint previously.
    I've seen a 10 times performance improvement within these approaches.

And there are still some things we can do better but not in this patch.

  1. We can build a virtual DOM tree to store the mutations of DOM.
    This will minimize the number of DOM operations.
  2. Another thing that may help UX is to make the fast forward process async and cancellable.
    This may make the drag and drop interactions in the player's UI looks smooth.

Yuyz0112 added 2 commits July 11, 2020 10:25
related to #6

Since the currently 'play at any time offset' implementation is pretty simple,
there are many things we can do to optimize its performance.

In this patch, we do the following optimizations:
1. Ignore some of the events during fast forward.
   For example, when we are going to fast forward to 10 minutes later,
   we do not need to perform mouse movement events during this period.
2. Use a fragment element as the 'virtual parent node'.
   So newly added DOM nodes will be appended to this fragment node,
   and finally being appended into the document as a batch operation.
These changes reduce a lot of time which was spent on reflow/repaint previously.
I've seen a 10 times performance improvement within these approaches.

And there are still some things we can do better but not in this patch.
1. We can build a virtual DOM tree to store the mutations of DOM.
   This will minimize the number of DOM operations.
2. Another thing that may help UX is to make the fast forward process async and cancellable.
   This may make the drag and drop interactions in the player's UI looks smooth.
@Yuyz0112 Yuyz0112 merged commit 3e2b596 into master Jul 11, 2020
Alexays pushed a commit to ScreebApp/rrweb that referenced this pull request Dec 11, 2025
`createCDATASection` is [only supported on
XMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection#notes),
not HTMLDocument. Doing so on HTMLDocument will throw an exception and
break playback on the player.

This change will log a "Failed to rebuild" warning to the console
instead of throwing.

Fixes
https://sentry.sentry.io/issues/5222059335/?project=11276&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&sort=date&statsPeriod=90d&stream_index=11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant