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

⚡[RUMF-1344] Serialize scroll positions only for full snapshots #1670

Merged
merged 5 commits into from
Aug 9, 2022

Conversation

bcaudan
Copy link
Contributor

@bcaudan bcaudan commented Aug 2, 2022

Motivation

Accessing scroll positions of DOM elements during serialization is costly so let's avoid to do it when we can.

Changes

First step, when serializing:

  • DOM mutations => don't serialize scroll positions
  • full snapshots => access scroll attributes to serialize scroll positions

Follow up in next PR:

  • access scroll attributes only on initial full snapshot

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@bcaudan bcaudan force-pushed the bcaudan/remove-scroll branch from 82b9474 to a930fa1 Compare August 3, 2022 14:32
@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2022

Codecov Report

Merging #1670 (df8bb4a) into main (8dec744) will increase coverage by 0.00%.
The diff coverage is 64.70%.

@@           Coverage Diff           @@
##             main    #1670   +/-   ##
=======================================
  Coverage   90.71%   90.72%           
=======================================
  Files         127      127           
  Lines        4696     4699    +3     
  Branches     1051     1052    +1     
=======================================
+ Hits         4260     4263    +3     
  Misses        436      436           
Impacted Files Coverage Δ
packages/rum/src/domain/record/mutationObserver.ts 96.37% <ø> (ø)
packages/rum/src/domain/record/observers.ts 73.65% <ø> (ø)
packages/rum/src/domain/record/record.ts 70.96% <ø> (ø)
packages/rum/test/htmlAst.ts 91.66% <ø> (ø)
packages/rum/src/domain/record/viewports.ts 75.00% <40.00%> (+1.47%) ⬆️
packages/rum/src/domain/record/serialize.ts 91.02% <100.00%> (+0.05%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@bcaudan bcaudan force-pushed the bcaudan/remove-scroll branch 4 times, most recently from c80d00e to 9f2febf Compare August 4, 2022 16:03
@bcaudan bcaudan changed the title ⚡[RUMF-1344] Improve scroll positions recording performance ⚡[RUMF-1344] Serialize scroll positions only for full snapshots Aug 5, 2022
@bcaudan bcaudan force-pushed the bcaudan/remove-scroll branch from 9f2febf to eca9052 Compare August 5, 2022 13:03
@bcaudan bcaudan force-pushed the bcaudan/remove-scroll branch from eca9052 to 3f701c4 Compare August 5, 2022 13:23
@bcaudan bcaudan marked this pull request as ready for review August 5, 2022 13:23
@bcaudan bcaudan requested review from a team as code owners August 5, 2022 13:23
Copy link
Contributor

@liywjl liywjl left a comment

Choose a reason for hiding this comment

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

Nice work!

@bcaudan bcaudan merged commit 3777c3d into main Aug 9, 2022
@bcaudan bcaudan deleted the bcaudan/remove-scroll branch August 9, 2022 08:30
@bcaudan bcaudan restored the bcaudan/remove-scroll branch August 9, 2022 08:30
@bcaudan bcaudan deleted the bcaudan/remove-scroll branch September 13, 2022 14:55
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.

4 participants