Skip to content

ref(build): Parallelize integration bundling #4707

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

Merged
merged 2 commits into from
Mar 15, 2022

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented Mar 11, 2022

Given that now most of our testing runs in parallel in CI, the biggest bottleneck has become the build step. Within that step, the single slowest thing we do is build integration bundles, simply because of the number of bundles which need to be created. (This is especially true now that we're creating three versions of each bundle rather than two.)

To speed things up a bit, this parallelizes the building of those bundles. Though it ends up not being as dramatic a time savings as one might hope (because the typescript plugin's caching mechanism doesn't play nicely with concurrent builds), it nonetheless drops the total build time from roughly two minutes down to 70-80 seconds in my local testing.

Ref: https://getsentry.atlassian.net/browse/WEB-664

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2022

size-limit report

Path Base Size (ec8da92) Current Size Change
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.41 KB 19.41 KB +0.01% 🔺
@sentry/browser - ES5 CDN Bundle (minified) 61.99 KB 61.99 KB 0%
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.07 KB 18.07 KB +0.02% 🔺
@sentry/browser - ES6 CDN Bundle (minified) 55.39 KB 55.39 KB 0%
@sentry/browser - Webpack (gzipped + minified) 22.34 KB 22.34 KB 0%
@sentry/browser - Webpack (minified) 76.64 KB 76.64 KB 0%
@sentry/react - Webpack (gzipped + minified) 22.37 KB 22.37 KB 0%
@sentry/nextjs Client - Webpack (gzipped + minified) 46.55 KB 46.55 KB 0%
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.29 KB 25.29 KB +0.01% 🔺
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 23.67 KB 23.67 KB +0.01% 🔺

Copy link
Contributor

@lforst lforst left a comment

Choose a reason for hiding this comment

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

Works great!

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

LGTM. Good idea to use environment variables to pass the file name!

Side question: As far as I can see, we're currently "only" producing ES5 versions of the integration bundles. Is this because of localforage?

@lobsterkatie
Copy link
Member Author

Side question: As far as I can see, we're currently "only" producing ES5 versions of the integration bundles. Is this because of localforage?

No, with localforage it's a cjs vs. esm question. Honestly, the reason we don't have ES6 versions is mostly because no one's ever asked for them.

(I was about to say, "Anyway, soon enough we'll only have ES6 versions," but it occurs to me that in fact if we're going to continue to publish a legacy browser bundle, we also probably are going to want to publish legacy integration and tracing bundles as well. It'll just be a matter of which JS version is the default.)

@Lms24
Copy link
Member

Lms24 commented Mar 11, 2022

I see, makes sense, thanks. That's gonna be a lot of bundles 😅

@lobsterkatie
Copy link
Member Author

That's gonna be a lot of bundles 😅

Fortunately, you need two totally separate instances of the TS plugin to target ES5 vs ES6, so those definitely can be run side by side. (Famous last words...)

@lobsterkatie lobsterkatie force-pushed the kmclb-parallelize-integration-bundling branch from 69bacaa to e5355ce Compare March 14, 2022 22:22
@lobsterkatie lobsterkatie merged commit 57a8997 into master Mar 15, 2022
@lobsterkatie lobsterkatie deleted the kmclb-parallelize-integration-bundling branch March 15, 2022 01:30
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.

3 participants