parcel icon indicating copy to clipboard operation
parcel copied to clipboard

ExperimentalBundler: merge bundleBehavior for isolated dependencies

Open wbinnssmith opened this issue 2 years ago • 4 comments

This:

  • ~Adds a nullable property mainEntryAsset to bundle objects in the ExperimentalBundler for ease of reference~
  • Combines bundles down to the "lowest common denominator" by overriding bundleBehavior ~and needsStableName~ based on other incoming dependencies. This is a breaking change from the current bundler, trading potential asset deduplication for bundle deduplication.

One case we'll need to handle before landing: ~* [ ] Marking a bundle as existing both as an inline bundle and a non-inline bundle. Currently we never write inline bundles to disk. In this case we'll need to.~ Let's defer this, as it seems like different asset bundleBehavior creates different assets, and as far as I can tell, it's not possible to have a non-inline asset and an inline dependency.

Test Plan: Adjusted existing test(s) to use the reduced bundle count

wbinnssmith avatar May 03 '22 23:05 wbinnssmith

Benchmark Results

Kitchen Sink 🚨

Timings

Description Time Difference
Cold FAILED -0.00ms
Cached FAILED -0.00ms

Cold Bundles

No bundles found, this is probably a failed build...

Cached Bundles

No bundles found, this is probably a failed build...

React HackerNews ✅

Timings

Description Time Difference
Cold 9.15s +19.00ms
Cached 441.00ms +4.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

AtlasKit Editor ✅

Timings

Description Time Difference
Cold 1.58m -964.00ms
Cached 2.58s +4.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

Bundle Size Difference Time Difference
dist/esm.6190c9ac.js 61.54kb +0.00b 39.21s -33.05s 🚀
dist/index.html 240.00b +0.00b 35.47s -36.82s 🚀
Three.js ✅

Timings

Description Time Difference
Cold 6.58s +34.00ms
Cached 268.00ms -10.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

parcel-benchmark avatar May 04 '22 00:05 parcel-benchmark

different asset bundleBehavior creates different assets

I think asset.bundleBehavior but not dependency.bundleBehavior? https://github.com/parcel-bundler/parcel/blob/e51955f9d4fa4009a611ba7e88bd85d0fd4c53a2/packages/core/core/src/Dependency.js#L44-L53

devongovett avatar May 09 '22 14:05 devongovett

This is probably a blocker for #8000; probably best to decide how exactly duplicate assets with different bundleBehavior should be bundled before deciding whether to merge generated dependencies or not.

101arrowz avatar May 16 '22 21:05 101arrowz

Is this still needed @wbinnssmith @AGawrys?

devongovett avatar Jul 31 '22 16:07 devongovett

This was merged as part of another PR.

devongovett avatar Oct 24 '22 04:10 devongovett