ember-cli / ember-cli-htmlbars

MIT License
77 stars 67 forks source link

Parallel compilations appears to troll hash-for-dep cache #623

Open asakusuma opened 6 years ago

asakusuma commented 6 years ago

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 ember-cli-htmlbars-inline-precompile@1.0.2. 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

stefanpenner commented 6 years ago

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.

scalvert commented 6 years ago

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.

stefanpenner commented 6 years ago

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

asakusuma commented 6 years ago

@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?

stefanpenner commented 6 years ago

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)

rwjblue commented 3 years ago

Is this still an issue?