Significant code reload slowdown with :npm-deps
Description
Environment
Attachments
Activity

Comment made by: alexisvincent
I'm still getting this with 1.9.946. Oddly enough it happens every other reload/eval. On a toy project, including react, with an empty file I get alternating reload/eval times of +-0.8 seconds and +-9 seconds. Removing react from npm-deps brings all reloads to +-0.8s.

Comment made by: tony.kay
So, I did some profiling with visualvm, and gave the results to Antonio. They were showing the vast majority of the time being consumed by `pipe`, under the direction of the node module discovery functions. His new version of the second patch definitely improves reload speed considerably. My hot code reload went from about 14 seconds (via patch 1) to 2 seconds with the new version of patch 2. This is on a project with Om Next, and some largish node libraries.

The attached CLJS-2339-2.patch contains the changes in the previous patch and also solves the issues around reloading, only running the foreign libraries that are modules through Closure if any of the source files in the dependency graph have changed.
I'd appreciate if people who are seeing the issue can try out the patch and report back.

So it looks like this is a 2-part problem.
The first one, which my patch solved, is related to CLJS compilation (where we were performing unnecessary computations on every symbol analysis – which slowed down proportionally to the number of JS modules processed).
The second problem is that we process every JS module on every code reload: the solution for this one is implementing a strategy for figuring out if we need to process JS modules again (e.g. based on last modified timestamps of source files, just like `cljs.compiler/requires-compilation?`).
Details
Details
Assignee
Reporter

After migrating our dependencies from cljsjs to node_modules we noticed that figwheel took a lot longer to reload our code.
I asked in #clojurescript if anyone had an idea of what could be done and @anmonteiro wrote:
@petterik might just be because we're processing all your node dependencies through Closure on every reload feel free to open a JIRA ticket, we could probably employ a caching strategy somewhere
Versions used:
clojurescript "1.9.908"
lein-figwheel "0.5.13"
npm-depm deps:
:react-helmet "5.1.3"
:react "15.6.1"
:react-dom "15.6.1"
as well as some devDependencies in package.json.