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

Optimize bootstrap duration #891

Closed
1 task
evertonfraga opened this issue Sep 23, 2020 · 1 comment
Closed
1 task

Optimize bootstrap duration #891

evertonfraga opened this issue Sep 23, 2020 · 1 comment
Assignees

Comments

@evertonfraga
Copy link
Contributor

evertonfraga commented Sep 23, 2020

When changing branches, the developer is penalized with a >100s worth of Lerna bootstrap and installation processes to have their deps working properly.

Analysis

Today's recommended one-command-to-solve-it-all command is to just run npm i on the root directory. Although convenient, the first step is rarely needed, and takes significant time (18%)

  1. root npm i: installs/updates dependencies on the root package (basically just lerna)
  2. which calls npm run bootstrap, installing packages dependencies and linking them locally
  3. and only then: npm run build, that after PR Updates to ethereumjs-config v2.0.0 (old) #886 will for both Node and Browser.

Fixes

npm i from root does not need to be run every time

The root npm i usually deletes the contents of the root node_modules, because the hoisted dependencies are not present on the root package.json, while the bootstrap command installs them over again. Nonsense, right?
If we just take the shortcut, starting directly from npm run bootstrap, we cut the 22s from the root npm i itself, and as the node_modules directory is already populated, we cut another ~30s from the bootstrap itself.

❇️ advice: whenever changing branches, prefer using npm run bootstrap over npm i

before after
root npm i 22s 0s
lerna bootstrap 55s 25s
build 43s 43s
  • Update documentation to highlight bootstrap as the main command to use on a daily basis.

~57% of improvement so far.

Next optimization candidates

  • Experiment with Yarn for more parallel work and better caching (great potential for optimization) Implementing yarn workspaces 🚀 #900
  • Build only node dependencies, instead of node+browser
  • Enabling --no-audit on npm commands
  • Enabling --prefer-offline to save on network requests
  • Experiment running with Verdaccio, to save on roundtrips to npm registry.
@evertonfraga evertonfraga self-assigned this Sep 23, 2020
@evertonfraga evertonfraga linked a pull request Oct 6, 2020 that will close this issue
2 tasks
@holgerd77
Copy link
Member

Outdated (lerna) and no activity for a long time, will close.

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 a pull request may close this issue.

2 participants