DataDog / browser-sdk

Datadog Browser SDK
Apache License 2.0
294 stars 131 forks source link

⚡ [RUM-157] Caching Stylesheets serialisation #2829

Closed nulrich closed 3 months ago

nulrich commented 3 months ago

Motivation

When performing a FullSnapshot, all CSS StyleSheets are serialized. This process can block the main thread for an extended period in applications using lots of CSS.

This operation occurs even when the CSS remain unchanged, so caching the stylesheets until they change would be beneficial especially in SPA applications.

image

Changes

Testing


I have gone over the contributing documentation.

cit-pr-commenter[bot] commented 3 months ago

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 160.25 KiB 160.84 KiB 600 B +0.37%
Logs 57.91 KiB 57.91 KiB 0 B 0.00%
Rum Slim 108.77 KiB 108.77 KiB 0 B 0.00%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%

🚀 CPU Performance | Action Name | Base Average Cpu Time (ms) | Local Average Cpu Time (ms) | 𝚫 | | --- | --- | --- | --- | | addglobalcontext | 0.001 | 0.002 | 0.000 | | addaction | 0.030 | 0.034 | 0.004 | | adderror | 0.032 | 0.034 | 0.002 | | addtiming | 0.001 | 0.001 | 0.000 | | startview | 0.893 | 1.980 | 1.087 | | startstopsessionreplayrecording | 0.771 | 1.482 | 0.710 | | logmessage | 0.020 | 0.026 | 0.006 |
🧠 Memory Performance | Action Name | Base Consumption Memory (bytes) | Local Consumption Memory (bytes) | 𝚫 (bytes) | | --- | --- | --- | --- | | addglobalcontext | 22.20 KiB | 19.63 KiB | -2634 B | | addaction | 71.94 KiB | 70.41 KiB | -1567 B | | adderror | 88.93 KiB | 85.73 KiB | -3274 B | | addtiming | 21.90 KiB | 15.62 KiB | -6426 B | | startview | 314.64 KiB | 317.90 KiB | 3.26 KiB | | startstopsessionreplayrecording | 13.51 KiB | 12.32 KiB | -1213 B | | logmessage | 72.84 KiB | 67.06 KiB | -5920 B |

🔗 RealWorld

codecov-commenter commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.33%. Comparing base (c48a9bd) to head (5245aa4). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2829 +/- ## ========================================== + Coverage 93.31% 93.33% +0.02% ========================================== Files 263 263 Lines 7482 7505 +23 Branches 1669 1674 +5 ========================================== + Hits 6982 7005 +23 Misses 500 500 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

nulrich commented 3 months ago

/to-staging

dd-devflow[bot] commented 3 months ago

:steam_locomotive: Branch Integration: starting soon, median merge time is 14m

Commit 5245aa4a52 will soon be integrated into staging-27.

Use /to-staging -c to cancel this operation!

dd-devflow[bot] commented 3 months ago

:steam_locomotive: Branch Integration: This commit was successfully integrated

Commit 5245aa4a52 has been merged into staging-27 in merge commit dce9a2e5ee.

Check out the triggered pipeline on Gitlab :fox_face: