I had noticed that v2 of the generator seemed to be significantly slower to finish than the same tasks in v1, so I decided to run a side-by-side test. Both arrive at almost identical project installs:
v1
34.63 seconds
v2
52.75 seconds
I'm pretty sure the difference between the two is almost entirely because of the difference in how they handle yarn installs.
Yarn is very efficient at optimizing package installation, and part of how it does this is by pre-calculating the shared dependencies between all of the packages it is about to install, and and optimizing/caching package installation.
With v1 we were running yarn only once or twice every time the generator is run; once for dev dependencies and once for all other dependencies. With v2, we run yarn 4 or more separate times, which means that yarn can't optimize installation across any of those runs.
Its not huge big deal, I'm willing to wait a minute to run the generator, but if there was any way we can optimize yarn installs across all composed generators it would be a sizable performance improvement.
I think it should be possible to only run yarnInstall once by pushing our dependencies to an array throughout the process, then only running yarnInstall in the parent generator's index file.
I had noticed that v2 of the generator seemed to be significantly slower to finish than the same tasks in v1, so I decided to run a side-by-side test. Both arrive at almost identical project installs:
v1 34.63 seconds
v2 52.75 seconds
I'm pretty sure the difference between the two is almost entirely because of the difference in how they handle yarn installs.
Yarn is very efficient at optimizing package installation, and part of how it does this is by pre-calculating the shared dependencies between all of the packages it is about to install, and and optimizing/caching package installation.
With v1 we were running
yarn
only once or twice every time the generator is run; once for dev dependencies and once for all other dependencies. With v2, we runyarn
4 or more separate times, which means that yarn can't optimize installation across any of those runs.Its not huge big deal, I'm willing to wait a minute to run the generator, but if there was any way we can optimize yarn installs across all composed generators it would be a sizable performance improvement.