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

⚡ Performance Friday Reduce Bundle Size #2875

Merged
merged 12 commits into from
Jul 24, 2024

Conversation

RomanGaignault
Copy link
Contributor

@RomanGaignault RomanGaignault commented Jul 19, 2024

Motivation

Avoid using useless ?. to reduce bundle size
While those operators are quite nice additions to ES, they can produce an unexpected amount of code. Example:
f?.stop()
// bundled as (30 bytes):
null===f||void 0===f||f.stop()

Changes

Instead, using standard “boring” syntax is usually generating less code:
if (f) f.stop()
// bundled as (11 bytes):
f&&f.stop()

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

Copy link

cit-pr-commenter bot commented Jul 19, 2024

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 161.62 KiB 161.42 KiB -202 B -0.12%
Logs 57.95 KiB 57.89 KiB -53 B -0.09%
Rum Slim 110.14 KiB 109.99 KiB -151 B -0.13%
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.041 0.010
adderror 0.031 0.036 0.005
addtiming 0.001 0.001 0.000
startview 0.913 1.080 0.167
startstopsessionreplayrecording 0.780 0.868 0.089
logmessage 0.019 0.021 0.002
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 20.46 KiB 21.42 KiB 984 B
addaction 72.73 KiB 73.49 KiB 774 B
adderror 86.60 KiB 88.79 KiB 2.19 KiB
addtiming 19.47 KiB 19.66 KiB 195 B
startview 349.22 KiB 354.13 KiB 4.91 KiB
startstopsessionreplayrecording 14.21 KiB 13.90 KiB -322 B
logmessage 70.55 KiB 73.11 KiB 2.57 KiB

🔗 RealWorld

@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.67%. Comparing base (2490414) to head (ff5491e).
Report is 4 commits behind head on main.

Files Patch % Lines
...ckages/core/src/transport/startBatchWithReplica.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2875      +/-   ##
==========================================
- Coverage   93.68%   93.67%   -0.01%     
==========================================
  Files         266      266              
  Lines        7584     7591       +7     
  Branches     1687     1688       +1     
==========================================
+ Hits         7105     7111       +6     
- Misses        479      480       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RomanGaignault RomanGaignault marked this pull request as ready for review July 22, 2024 12:28
@RomanGaignault RomanGaignault requested a review from a team as a code owner July 22, 2024 12:28
@RomanGaignault RomanGaignault changed the title Performance Friday Reduce Bundle Size ⚡ Performance Friday Reduce Bundle Size Jul 22, 2024
@RomanGaignault
Copy link
Contributor Author

/to-staging

@dd-devflow
Copy link
Contributor

dd-devflow bot commented Jul 24, 2024

🚂 Branch Integration: starting soon, median merge time is 12m

Commit ff5491efd3 will soon be integrated into staging-30.

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

dd-mergequeue bot added a commit that referenced this pull request Jul 24, 2024
…aging-30

Integrated commit sha: ff5491e

Co-authored-by: roman.gaignault <roman.gaignault@datadoghq.com>
@dd-devflow
Copy link
Contributor

dd-devflow bot commented Jul 24, 2024

🚂 Branch Integration: This commit was successfully integrated

Commit ff5491efd3 has been merged into staging-30 in merge commit a6e3950971.

Check out the triggered pipeline on Gitlab 🦊

@RomanGaignault RomanGaignault merged commit 159a305 into main Jul 24, 2024
21 checks passed
@RomanGaignault RomanGaignault deleted the roman/performance-friday-reduce-bundle-size branch July 24, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants