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

achan3/P2X-1041 new disableSharedBundles config option #9209

Merged
merged 24 commits into from
Sep 22, 2023

Conversation

adelchan07
Copy link
Contributor

@adelchan07 adelchan07 commented Aug 22, 2023

↪️ Pull Request

Support a new disableSharedBundles config option during bundler creation

  • add a new warning for disableSharedBundles config as disabling creation of shared bundles will override values for minBundles and maxParallelSize config options
  • allow disableSharedBundles config to be set through a command-line flag

💻 Examples

🚨 Test instructions

cd parcel/packages/core/integration-tests
yarn test test/bundler.js

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

@adelchan07 adelchan07 changed the title Achan3/p2 x 1041 add warnings achan3/P2X-1041 add warnings Aug 22, 2023
@adelchan07 adelchan07 changed the title achan3/P2X-1041 add warnings achan3/P2X-1041 add warnings for disableSharedBundles config option Aug 22, 2023
@parcel-benchmark
Copy link

parcel-benchmark commented Aug 22, 2023

Benchmark Results

Kitchen Sink ✅

Timings

Description Time Difference
Cold 1.49s +14.00ms
Cached 262.00ms -17.00ms 🚀

Cold Bundles

No bundle changes detected.

Cached Bundles

Bundle Size Difference Time Difference
dist/legacy/index.html 826.00b +0.00b 421.00ms +22.00ms ⚠️
dist/modern/index.html 749.00b +0.00b 421.00ms +22.00ms ⚠️

React HackerNews ✅

Timings

Description Time Difference
Cold 4.18s +67.00ms
Cached 415.00ms -10.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/PermalinkedComment.3145598b.js 3.94kb +0.00b 412.00ms +61.00ms ⚠️
dist/UserProfile.b37bbaff.js 1.38kb +0.00b 412.00ms +61.00ms ⚠️
dist/NotFound.c08212ea.js 265.00b +0.00b 412.00ms +61.00ms ⚠️
dist/logo.8dd07848.png 244.00b +0.00b 279.00ms +47.00ms ⚠️

Cached Bundles

Bundle Size Difference Time Difference
dist/PermalinkedComment.3145598b.js 3.94kb +0.00b 351.00ms +23.00ms ⚠️
dist/UserProfile.b37bbaff.js 1.38kb +0.00b 350.00ms +22.00ms ⚠️
dist/NotFound.c08212ea.js 265.00b +0.00b 351.00ms +23.00ms ⚠️
dist/logo.8dd07848.png 244.00b +0.00b 251.00ms +25.00ms ⚠️

AtlasKit Editor ✅

Timings

Description Time Difference
Cold 37.88s -524.00ms
Cached 2.47s +51.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/index.c9a8b20f.js 3.79mb +0.00b 18.43s -1.11s 🚀
dist/pdfRenderer.4cf5cffc.js 1.11mb +0.00b 14.24s -1.05s 🚀
dist/mobile-upload.0917d4f0.js 66.50kb +0.00b 5.67s -306.00ms 🚀
dist/component-lazy.aeb22f50.js 59.50kb +0.00b 6.07s -967.00ms 🚀
dist/component.508d12ab.js 57.88kb +0.00b 5.67s -306.00ms 🚀
dist/Modal.f90b31a7.js 28.20kb +0.00b 5.66s -313.00ms 🚀
dist/component.d038388b.js 18.68kb +0.00b 5.66s -313.00ms 🚀
dist/js.9cb9c5be.js 17.21kb +0.00b 5.64s -321.00ms 🚀
dist/mobile-upload.86840439.js 7.86kb +0.00b 5.66s -313.00ms 🚀
dist/Modal.efe95f7f.js 3.87kb +0.00b 5.66s -313.00ms 🚀
dist/component.342752e9.js 3.22kb +0.00b 5.66s -315.00ms 🚀
dist/png-chunks-extract.01ed8f60.js 3.06kb +0.00b 5.64s -321.00ms 🚀
dist/codeViewerRenderer.7d374cd5.js 2.61kb +0.00b 9.15s -4.11s 🚀
dist/workerHasher.e01f8bcf.js 1.56kb +0.00b 5.64s -321.00ms 🚀
dist/16.a4c7368c.js 1.35kb +0.00b 5.67s -307.00ms 🚀
dist/16.347f2ad3.js 1.28kb +0.00b 5.66s -313.00ms 🚀
dist/16.1d939d76.js 1.00kb +0.00b 5.66s -312.00ms 🚀
dist/16.92be0d97.js 976.00b +0.00b 5.66s -313.00ms 🚀
dist/16.5befcdea.js 976.00b +0.00b 5.66s -311.00ms 🚀
dist/16.ef2df2b6.js 956.00b +0.00b 5.66s -312.00ms 🚀
dist/16.01cdc55d.js 916.00b +0.00b 5.67s -306.00ms 🚀
dist/16.8fc349c9.js 858.00b +0.00b 5.67s -307.00ms 🚀
dist/16.c5423dbe.js 830.00b +0.00b 5.67s -306.00ms 🚀
dist/16.1be49b4b.js 823.00b +0.00b 5.66s -312.00ms 🚀
dist/16.924dd2e3.js 778.00b +0.00b 5.67s -307.00ms 🚀
dist/16.01e372d3.js 772.00b +0.00b 5.66s -312.00ms 🚀
dist/16.0cd21a5f.js 772.00b +0.00b 5.66s -312.00ms 🚀
dist/16.a0490963.js 771.00b +0.00b 5.66s -313.00ms 🚀
dist/16.a5f45cdb.js 770.00b +0.00b 5.66s -313.00ms 🚀
dist/16.bc1a05f3.js 769.00b +0.00b 5.66s -312.00ms 🚀
dist/16.e3d16653.js 721.00b +0.00b 5.66s -313.00ms 🚀
dist/16.592b5fd3.js 693.00b +0.00b 5.67s -306.00ms 🚀
dist/simpleHasher.329400f6.js 585.00b +0.00b 5.64s -321.00ms 🚀
dist/ro.ee42c980.js 478.00b +0.00b 6.77s -2.50s 🚀

Cached Bundles

Bundle Size Difference Time Difference
dist/refractor.61b4c5e1.js 601.68kb +0.00b 13.55s +918.00ms ⚠️
dist/media-viewer.bc1a2415.js 537.32kb +0.00b 9.61s -3.01s 🚀
dist/popup.32b3d0ef.js 324.46kb +0.00b 13.55s +918.00ms ⚠️
dist/EmojiPickerComponent.c199902f.js 189.68kb +0.00b 13.52s +896.00ms ⚠️
dist/ConfigPanelFieldsLoader.1a016f33.js 82.96kb +0.00b 13.52s +895.00ms ⚠️
dist/esm.5b5f7c9f.js 63.36kb +0.00b 13.55s +919.00ms ⚠️
dist/archive.fe044de4.js 60.16kb +0.00b 13.55s +918.00ms ⚠️
dist/component-lazy.aeb22f50.js 59.50kb +0.00b 6.88s +847.00ms ⚠️
dist/esm.f9edadb2.js 39.42kb +0.00b 13.55s +917.00ms ⚠️
dist/smartMediaEditor.226eb0f2.js 21.76kb +0.00b 13.55s +919.00ms ⚠️
dist/esm.a421c1ca.js 20.52kb +0.00b 13.55s +919.00ms ⚠️
dist/dropzone.452cdf0e.js 13.48kb +0.00b 13.55s +919.00ms ⚠️
dist/dropzone.eff4ce1e.js 11.51kb +0.00b 13.55s +918.00ms ⚠️
dist/Toolbar.759db587.js 9.40kb +0.00b 13.55s +919.00ms ⚠️
dist/clipboard.121b0510.js 7.94kb +0.00b 13.55s +919.00ms ⚠️
dist/mobile-upload.d7818b6e.js 7.86kb +0.00b 13.55s +918.00ms ⚠️
dist/index.runtime.1064c960.js 7.29kb +0.00b 13.56s +911.00ms ⚠️
dist/browser.857fa69b.js 7.20kb +0.00b 13.55s +918.00ms ⚠️
dist/index.b16227d6.css 4.08kb +0.00b 13.57s +915.00ms ⚠️
dist/media-viewer-analytics-error-boundary.54c54975.js 3.19kb +0.00b 13.55s +919.00ms ⚠️
dist/media-picker-analytics-error-boundary.6a30027d.js 3.19kb +0.00b 13.55s +918.00ms ⚠️
dist/media-card-analytics-error-boundary.b80de757.js 3.19kb +0.00b 13.55s +918.00ms ⚠️
dist/codeViewerRenderer.7d374cd5.js 2.61kb +0.00b 13.55s +4.38s ⚠️
dist/workerHasher.65b703b7.js 1.56kb +0.00b 13.55s +919.00ms ⚠️
dist/workerHasher.100ea0bf.js 1.56kb +0.00b 13.55s +917.00ms ⚠️
dist/workerHasher.81697bdc.js 1.56kb +0.00b 13.55s +917.00ms ⚠️
dist/simpleHasher.88f1b387.js 585.00b +0.00b 13.55s +919.00ms ⚠️
dist/simpleHasher.2c36efc2.js 585.00b +0.00b 13.55s +917.00ms ⚠️
dist/simpleHasher.37be2994.js 585.00b +0.00b 13.55s +917.00ms ⚠️
dist/ro.ee42c980.js 478.00b +0.00b 9.61s +2.91s ⚠️
dist/index.html 248.00b +0.00b 13.62s +937.00ms ⚠️

Three.js ✅

Timings

Description Time Difference
Cold 3.09s +31.00ms
Cached 336.00ms -5.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/Three.js 572.22kb +0.00b 1.01s -55.00ms 🚀

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

await bundle(
path.join(
__dirname,
'integration/disable-shared-bundles-false-with-min-bundle-size/index.js',
Copy link
Member

Choose a reason for hiding this comment

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

since disable-shared-bundles-false-with-min-bundle-size has essentially the same contents as disable-shared-bundles-false we could probably reuse one of them, and get rid of the other

packages/core/integration-tests/test/bundler.js Outdated Show resolved Hide resolved
@gorakong
Copy link
Member

so i think we could probably condense these tests to 4 cases:

disablesharedbundles explicitly set to false:

  • assert that it doesn’t warn
  • assert that creates a shared bundle

disablesharedbundles explicitly set to true w minBundles set:

  • assert that it does warn
  • assert that it doesn’t create shared bundles

disablesharedbundles explicitly set to true w maxParallelRequests set:

  • assert that it does warn
  • assert that it doesn’t create shared bundles

disablesharedbundles explicitly set to true w both minBundles and maxParallelRequests set:

  • assert that it does warn
  • assert that it doesn’t create shared bundles

@AGawrys
Copy link
Contributor

AGawrys commented Aug 24, 2023

There's a test case called should reuse a bundle when its main asset (aka bundleroot) is imported sychronously in javascript.js where we force an async bundle to act as a shared bundle since it's entry asset & contents are imported synchronously by someone else. This is technically a shared bundle, so we should probably prevent this from happening in the case that someone disables shared bundes.

@adelchan07 adelchan07 changed the title achan3/P2X-1041 add warnings for disableSharedBundles config option achan3/P2X-1041 new disableSharedBundles config option Aug 25, 2023
@adelchan07
Copy link
Contributor Author

adelchan07 commented Aug 29, 2023

There's a test case called should reuse a bundle when its main asset (aka bundleroot) is imported sychronously in javascript.js where we force an async bundle to act as a shared bundle since it's entry asset & contents are imported synchronously by someone else. This is technically a shared bundle, so we should probably prevent this from happening in the case that someone disables shared bundes.

scenario handled in 18f6510

Copy link
Contributor

@AGawrys AGawrys left a comment

Choose a reason for hiding this comment

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

I would also bar // Step Remove Shared Bundles from occurring as well if disableSharedBundles is true. Because that section looks up bundles and sorts them before we even know if the bundle group contains shared bundles, which is just extra work that shouldn't occur ideally

packages/bundlers/default/src/DefaultBundler.js Outdated Show resolved Hide resolved
@adelchan07 adelchan07 added SVG and removed SVG labels Sep 8, 2023
@adelchan07 adelchan07 merged commit 6dcba36 into v2 Sep 22, 2023
16 checks passed
@adelchan07 adelchan07 deleted the achan3/P2X-1041-add-warnings branch September 22, 2023 01:03
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.

None yet

6 participants