-
Notifications
You must be signed in to change notification settings - Fork 142
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
Browser library bundle size is very large. #317
Comments
Hi @threehams, thanks a lot for your feedbacks. We have not put too much effort on bundle size analysis for now but it is definitely something that we have planned to work on. |
I've just pulled v1.25.2 into a project, and was also surprised at the size – still 30kb of minified JS. @bcaudan I would be happy to contribute if you would like to point me in the right direction. |
Update: According to Bundlephobia and I also tested it in my projects version 3.9.0 is now at almost 40 kB gzipped. That makes a significant amount of all optimized apps. Roughly 25% my total bundle size. Could you somehow put a little more focus to the bundle size? |
We've removed browser logging and RUM from our project due to the bundle size. It doesn't make sense to slow down a page in order to check if it's fast. Bundle size is something that needs monitoring to keep under control. There are a lot of projects out there to do this. |
Hello, Since version 3, the RUM SDK also include session replay logic which has legitimately increased our RUM bundle size. You can find links about this bundle in the packages section of the README.md. |
@bcaudan I was not aware of a smaller variant. Thanks for the hint. How likely is the chance that the slim becomes even smaller? 😁 |
We just realized an audit of our SDK bundled size. Here are the main efforts that we will work in the coming weeks/months:
Other notes:
|
@BenoitZugmeyer Nice. Thank you very much for so much transparency ⭐ Do you also consider to ship a variant that doesn't support IE11? In most projects, we stopped supporting it, so we could possibly benefit here as well. |
@fdc-viktor-luft We did consider creating a package supporting only ES6 syntax. It didn't yield significant-enough results to justify maintaining such package right now. Because IE11 will be retired in june, we will reconsider it and may drop IE11 altogether. |
We don't even need RUM at the moment, but only some basic logging in the browser, and with datadog on the server we are happy, so it would be a natural choice. But already Or is there a documented API for logging events, similar to https://bugsnagerrorreportingapi.docs.apiary.io/#reference/0/notify/send-error-reports, so that we could roll our own minimal version of |
Indeed, from bundlephobia link, browser-core represents 76,3% of browser-logs size.
We could consider extract some features as plugins at some point but it is not in our current priorities.
Yes, you can have a look at logs api. |
Thanks for the reply!
I didn't look at the source and the build process, but shouldn't webpack's tree-shaking take care of eliminating most of the things from browser-core when you build the minified production build of browser-logs? assuming you do things correctly that is... |
it should eliminate unused things, but browser-core contains code that is shared by logs and rum so I don't expect much code to not be used by logs. |
Last time I checked webpack's treeshaking works with ES6+ only. |
Looking at the production bundle for a webview, there are lot of large strings, and prototype stuff that can really take up a lot of space. |
@BenoitZugmeyer What's the status on this? Any updates? |
While this is still a topic we have in mind, we don't have further work planed just yet appart from removing IE support, which would allow us to use shorter ES6 syntaxes. |
Don't mean to pile on, but want to add a +1 to these concerns about package size. Even browser-rum-slim is 27kb gzipped, and appears to be growing with each release. Would love if this could be prioritized. |
Hey folks, I agree that using this package comes at a great cost to our end users only so we can gain observability into the UX metrics that we care about. There's a lot of focus on compressed bundle size but I'd like to call out that uncompressed bundle size matters as well. According to The Cost of JavaScript, low powered devices are CPU bound, not network bound. That means that even if your package is 10kb gzipped/brotli compressed over the wire, if the unpacked size is 100kb, that still comes at a cost for parsing and executing. At present : @datadog/browser-rum: If you look at companies like Speedcurve that are performance focused, you'll see an entire section about performance in their docs. The important part:
Apologies if this comes across as a dig or a |
According to bundlephobia the size of |
Hi there, adding another +1 on this thread. It's tough to swallow 50kB+ on the It's disappointing to see that after four(!!) years of this issue being open there seems to have been little effort in prioritizing it and the package(s) have gotten progressively larger over that time. Please consider spending some engineering time on this! |
How are folks handling this? The size of this package is very large. Are folks pivoting to async loading instead of relying on sync loading because of the performance implications? |
Hi! While looking into using Datadog RUM, I noticed the bundle size is much bigger than I'd expect: @datadog/browser-rum bundle analysis. Currently it's about half the size of our entire UI component library, including styles.
Most of this comes from @datadog/browser-core and its dependencies.
While there's a lot of code in the packages themselves, the size is mostly inefficiency in dependencies and bundling. This is good! It's the easiest to cut down.
Likely highest gains:
merge
andassign
functions in the project instead of usinglodash
. The two lodash imports account for almost 25% of the total size.tsc
to rollup, possibly using tsdx to save headaches. Rollup is specifically designed for building self-contained libraries, and will avoid thetslib
dependency (the second largest afterlodash
).The text was updated successfully, but these errors were encountered: