designcourse
designcourse copied to clipboard
⚡️ reduce bundle size by trimming `pako`
Motivation
This PR reduces the RUM bundle size by trimming the pako embedded in our codebase.
-
pako is a library implementing zlib in JS. pako/zlib provides some features and customizations that we don't use. This PR removes some of those features.
-
the pako build that we copied have some unnecessary verbose syntax, like relying on properties for constants (ex:
constants.Z_SYNC_FLUSH = xxx, minified asx.Z_SYNC_FLUSH=xxx) instead of using manglable variable declarations (var Z_SYNC_FLUSH = xxx, minified asvar x=xxx)
Changes
- remove support for options
level,windowBit,dictionary,headerandgzip, and associated code - some syntaxic changes
Please review commit by commit.
Testing
- [x] Local
- [ ] Staging
- [ ] Unit
- [ ] End to end
I have gone over the contributing documentation.
Bundles Sizes Evolution
| 📦 Bundle Name | Base Size | Local Size | 𝚫 | 𝚫% | Status |
|---|---|---|---|---|---|
| Rum | 161.62 KiB | 153.59 KiB | -8225 B | -4.97% | ✅ |
| Logs | 57.95 KiB | 57.95 KiB | 0 B | 0.00% | ✅ |
| Rum Slim | 110.14 KiB | 110.14 KiB | 0 B | 0.00% | ✅ |
| Worker | 25.21 KiB | 17.17 KiB | -8225 B | -31.87% | ✅ |
🚀 CPU Performance
| Action Name | Base Average Cpu Time (ms) | Local Average Cpu Time (ms) | 𝚫 |
|---|---|---|---|
| addglobalcontext | 0.001 | 0.002 | 0.001 |
| addaction | 0.030 | 0.053 | 0.023 |
| adderror | 0.031 | 0.038 | 0.007 |
| addtiming | 0.001 | 0.001 | 0.000 |
| startview | 0.913 | 1.411 | 0.498 |
| startstopsessionreplayrecording | 0.780 | 1.011 | 0.231 |
| logmessage | 0.019 | 0.023 | 0.004 |
🧠 Memory Performance
| Action Name | Base Consumption Memory (bytes) | Local Consumption Memory (bytes) | 𝚫 (bytes) |
|---|---|---|---|
| addglobalcontext | 20.46 KiB | 19.59 KiB | -889 B |
| addaction | 72.73 KiB | 70.35 KiB | -2443 B |
| adderror | 86.60 KiB | 85.91 KiB | -704 B |
| addtiming | 19.47 KiB | 17.79 KiB | -1714 B |
| startview | 349.22 KiB | 351.36 KiB | 2.14 KiB |
| startstopsessionreplayrecording | 14.21 KiB | 12.46 KiB | -1796 B |
| logmessage | 70.55 KiB | 69.00 KiB | -1583 B |
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 93.67%. Comparing base (
2490414) to head (dda2fb5).
Additional details and impacted files
@@ Coverage Diff @@
## main #2878 +/- ##
==========================================
- Coverage 93.68% 93.67% -0.02%
==========================================
Files 266 266
Lines 7584 7584
Branches 1687 1687
==========================================
- Hits 7105 7104 -1
- Misses 479 480 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
/to-staging
:steam_locomotive: Branch Integration: starting soon, median merge time is 12m
Commit dda2fb5ab9 will soon be integrated into staging-30.
Use /to-staging -c to cancel this operation!
:steam_locomotive: Branch Integration: This commit was successfully integrated
Commit dda2fb5ab9 has been merged into staging-30 in merge commit 0c0bbb7fdc.