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

make install takes 9 minutes #340

Open
debugwand opened this issue Jun 13, 2019 · 4 comments
Open

make install takes 9 minutes #340

debugwand opened this issue Jun 13, 2019 · 4 comments
Labels
help wanted Extra attention is needed housekeeping Cleaning things up

Comments

@debugwand
Copy link
Contributor

make install takes 9 minutes
the athloi task seems to be the slowest part

@i-like-robots
Copy link
Contributor

i-like-robots commented Jun 13, 2019

I think this is due to a combination of a few things:

  • npm is slow, running many npm installs is very slow
  • Sophos installed on FT laptops can compete for CPU whilst running npm install
  • .vscode and/or Spotlight can also get keen indexing node_modules whilst installing (you can configure both to not include node_modules in indexes)
  • Gatsby is huge
  • We build the docs site (Gatsby) on postinstall which we should probably not do. This is probably single the most expensive single task.

If you'd like to try the install step or other commands without Athloi to see if it makes any difference to your setup here are a few scripts to help:

Tasks in series:

#!/bin/bash
start=$(date +%s)

find ./{components,packages,tools} -name '*' -depth 1 -exec bash -c "cd '{}' && npm i" \;

end=$(date +%s)

echo "duration: $((end-start)) seconds."

And in parallel:

#!/bin/bash
start=$(date +%s)

find ./{components,packages,tools} -name '*' -depth 1 -print0 | xargs -0 -L 1 -P 10 bash -c 'cd "$0" && npm i'

end=$(date +%s)

echo "duration: $((end-start)) seconds."

(Using Athloi or vanilla bash shouldn't make any difference to speed but it's worth trying just in case)

@i-like-robots i-like-robots added the help wanted Extra attention is needed label Jun 13, 2019
@i-like-robots
Copy link
Contributor

i-like-robots commented Jun 13, 2019

There are two major improvements we could make that I am currently aware of:

  • Refactor the docs site not to use Gatsby (it is by far the largest dependency, and as mentioned above - takes a relatively long time to build)
  • Use Yarn instead of npm to avoid the repeated work of running multiple install tasks (we did try Yarn early on but Gatsby and Storybook didn't agree on anything. It also has a different syntax for symlinks which would need to be resolved.)

@i-like-robots
Copy link
Contributor

i-like-robots commented Jun 13, 2019

And to reiterate how how hard npm can have to fight for CPU, below are screenshots taken from activity monitor whilst running the install task. There are a few things here that might be worth investigating.

Screenshot 2019-06-13 at 15 47 13

Screenshot 2019-06-13 at 15 48 35

Anecdotally... my laptop at home - which is not as powerful as my work machine - takes < half the time to install and run x-dash.

Whatever the cause - this is something we need to improve.

@i-like-robots
Copy link
Contributor

make install on my home machine minus x-docs takes 63 seconds... so I think I know what to do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed housekeeping Cleaning things up
Projects
None yet
Development

No branches or pull requests

3 participants