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

Cache invalidations for packagers when reading other bundles #8370

Merged
merged 10 commits into from
Sep 7, 2022

Conversation

mischnic
Copy link
Member

@mischnic mischnic commented Aug 5, 2022

loadGlobalInfo is probably not a good name loadBundleConfig, same API as loadConfig (plus bundle and bundleGraph)

  • Test case

Comment on lines 274 to 277
// TODO expose config and let plugin set key?
config.cacheKey = hashString(JSON.stringify(config.result) ?? '');
Copy link
Member Author

@mischnic mischnic Aug 5, 2022

Choose a reason for hiding this comment

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

Should this new method also receive a config object (currently it doesn't)? Currently the cache key logic for the config is a bit counterintuitive, especially for this new usecase:

// If there is no result hash set by the transformer, default to hashing the included
// files if any, otherwise try to hash the config result itself.
if (config.cacheKey == null) {
if (config.invalidateOnFileChange.size > 0) {
hash.writeString(
await getInvalidationHash(
[...config.invalidateOnFileChange].map(filePath => ({
type: 'file',
filePath,
})),
options,
),
);
} else if (config.result != null) {
try {
hash.writeBuffer(serializeRaw(config.result));
} catch (err) {
throw new ThrowableDiagnostic({
diagnostic: {
message:
'Config result is not hashable because it contains non-serializable objects. Please use config.setCacheKey to set the hash manually.',
origin: pluginName,
},
});
}
}
} else {
hash.writeString(config.cacheKey ?? '');
}

But there would ideally still be some way to pass non-serializable data here.

@parcel-benchmark
Copy link

parcel-benchmark commented Aug 5, 2022

Benchmark Results

Kitchen Sink ✅

Timings

Description Time Difference
Cold 1.97s -44.00ms
Cached 429.00ms -20.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 107.00ms -225.00ms 🚀

Cached Bundles

Bundle Size Difference Time Difference
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 321.00ms -19.00ms 🚀
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 322.00ms -19.00ms 🚀
dist/modern/parcel.7cdb0fad.webp 102.94kb +0.00b 322.00ms -20.00ms 🚀
dist/legacy/index.b8ae99ba.css 94.00b +0.00b 333.00ms -18.00ms 🚀
dist/modern/index.31cedca9.css 94.00b +0.00b 332.00ms -18.00ms 🚀

React HackerNews 🚨

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...

AtlasKit Editor 🚨

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...

Three.js ✅

Timings

Description Time Difference
Cold 9.03s +218.00ms
Cached 345.00ms -9.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

Comment on lines +263 to +266
searchPath: joinProjectPath(
bundle.target.distDir,
bundle.name ?? bundle.id,
),
Copy link
Member Author

Choose a reason for hiding this comment

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

I think if name is null, then it's an inline bundle? Not sure what the searchPath should be in that case

@devongovett devongovett merged commit 65500fb into v2 Sep 7, 2022
@devongovett devongovett deleted the loadGlobalInfo branch September 7, 2022 04:33
dddlr added a commit to atlassian-labs/compiled that referenced this pull request Feb 7, 2023
Parcel v2.8.0 adds a BundleConfigType generic type to Optimizer
(parcel-bundler/parcel#8370) as part of
their `loadBundleConfig` method. We use a dummy type because we
don't need this functionality currently.
dddlr added a commit to atlassian-labs/compiled that referenced this pull request Feb 13, 2023
* chore(deps): update parcel packages

* Add dummy generic type so optimizer works with parcel v2.8.0+

Parcel v2.8.0 adds a BundleConfigType generic type to Optimizer
(parcel-bundler/parcel#8370) as part of
their `loadBundleConfig` method. We use a dummy type because we
don't need this functionality currently.

* Update snapshot tests for Parcel 2.8.3

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Grant Wong <gwong2@atlassian.com>
liamqma pushed a commit to atlassian-labs/compiled that referenced this pull request Feb 15, 2023
* chore(deps): update parcel packages

* Add dummy generic type so optimizer works with parcel v2.8.0+

Parcel v2.8.0 adds a BundleConfigType generic type to Optimizer
(parcel-bundler/parcel#8370) as part of
their `loadBundleConfig` method. We use a dummy type because we
don't need this functionality currently.

* Update snapshot tests for Parcel 2.8.3

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Grant Wong <gwong2@atlassian.com>
liamqma pushed a commit to atlassian-labs/compiled that referenced this pull request Feb 20, 2023
* Update 'ax' to accept short class name

* Update 'ax' flow type and up the size limit

* Add benchmark test to test ax(compressed class names)

* Change the format of compress class names

* Restore Flow type

* Compress class names

* Update snapshot

* chore(deps): update dependency @types/node to ^18.11.19 (#1407)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Turn off compressing class names if stylesheet extraction is off

* parcel integration

* Add changeset

* Replace rather than insert class name in the sheet and make ClassNames to support conditional CSS

* add 'generateCompressionMap'

* Update changelog

* Fix spelling mistake

* Allow uppercase in class-name-generator

* chore(deps): update dependency css-what to >=5.1.0 (#1409)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update webpack packages (#1411)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix transparent and currentcolor not being treated as a color (#1412)

* chore(deps): update dependency css-what to >=6.1.0 (#1414)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Version Packages (#1413)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore(deps): update dependency nth-check to >=2.1.1 (#1415)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency prettier to ^2.8.4 (#1416)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency @types/node to ^18.13.0 (#1417)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Bump node version to v18 (#1392)

* Bump node version to v18

* Bump import jsx

* Bump nvmrc node version from 18.12 to 18.14

* Add changeset for PR #1392

---------

Co-authored-by: Grant Wong <gwong2@atlassian.com>

* chore(deps): update parcel packages (#1390)

* chore(deps): update parcel packages

* Add dummy generic type so optimizer works with parcel v2.8.0+

Parcel v2.8.0 adds a BundleConfigType generic type to Optimizer
(parcel-bundler/parcel#8370) as part of
their `loadBundleConfig` method. We use a dummy type because we
don't need this functionality currently.

* Update snapshot tests for Parcel 2.8.3

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Grant Wong <gwong2@atlassian.com>

* chore(deps): update eslint packages (#1420)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency jest to v29 (#1384)

* chore(deps): update dependency jest to v29

* Update snapshots and node env for some tests

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Lane <jlane2@atlassian.com>

* Add Grant Wong as codeowner (#1421)

Co-authored-by: Grant Wong <2908767+dddlr@users.noreply.github.com>

* Replace rather than insert class name in the sheet and make ClassNames to support conditional CSS

* Add prefix option and avoid 'ad'

* Add comment to ax benchmark

* Make classNameCompressionMap a separate file in parcel example app

* Remove default reservedClassNames

* Export generateCompressionMap

* Update comment

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Lane <jlane2@atlassian.com>
Co-authored-by: atlas-dst-bot <81662413+atlas-dst-bot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Grant Wong <gwong2@atlassian.com>
Co-authored-by: Grant Wong <2908767+dddlr@users.noreply.github.com>
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