ember-cli-htmlbars icon indicating copy to clipboard operation
ember-cli-htmlbars copied to clipboard

Parallel compilations appears to troll hash-for-dep cache

Open asakusuma opened this issue 7 years ago • 6 comments

I noticed that rebuild time for a particular addon (with a lot of handlebars AST transforms) recently ballooned from a few seconds to 80-90 seconds.

It appears that something (I'm guessing the parallel compile) is causing hash-for-dep to be invoked as multiple modules, instead of a single module. Since the hash-for-dep cache is module scoped, invoking as multiple modules means that the cache is effectively useless.

EDIT: The cache was only created once in [email protected]. When I upgraded to 1.0.3 is when the multiple caches thing happened. There were other things also upgraded though at the same time.

cc @stefanpenner

asakusuma avatar Jul 26 '18 00:07 asakusuma

thanks, I think I'll try and (tonight) disable the parallel support in this plugin, until we re-work it to not have this issue.

stefanpenner avatar Jul 26 '18 00:07 stefanpenner

Specifically, the issue appears to be localized to the changes in babel-plugin-htmlbars-inline-precompile. Looking at the diff in v1.0.2 to v1.0.3, you can see that one of the dependency bumps includes babel-plugin-htmlbars-inline-precompile, where it reved version v0.2.3 to v0.2.5. v0.2.5 of that plugin contains fixes to parallel builds.

Pinning to v1.0.2 of this lib fixes the issue.

scalvert avatar Aug 20 '18 17:08 scalvert

@scalvert the plugin in question, needs to reduce what hash-for-dep considers a dependency of it. I explained how to @asakusuma.

Previously, this plugin was not correctly considering it's cache key or opted out of parallel.

Both the plugin in question, and this plugin need some work. But if the above recommendation I gave @asakusuma is applied the problem will go away entirely (and it will perform better then even the improvement here could do).

stefanpenner avatar Aug 23 '18 20:08 stefanpenner

@stefanpenner since I forgot, and for future travelers, can you explain how to control what ember-cli-htmlbars-inline-precompile's hash-for-dep thinks is a dependency?

asakusuma avatar Aug 30 '18 16:08 asakusuma

Improve hash-for-dep docs: https://github.com/stefanpenner/hash-for-dep/blob/master/README.md#what-does-hash-for-dep-consider-a-dependency

If something can be made clearer please open a PR/issue over there.

We will eventually add docs to the various consuming repos that have plugin authorship extensions (htmlbar/babel)

stefanpenner avatar Sep 11 '18 17:09 stefanpenner

Is this still an issue?

rwjblue avatar Oct 12 '20 22:10 rwjblue