Tired of Waiting (Updated)

Written on January 26, 2016

Whenever I run composer install or npm install I feel like an old man yelling at young punks to get off my lawn. Especially ever since npm3. I’ll save you the bitter diatribe and keep this brief.

Creating, distributing, maintaining, and consuming third-party dependencies was supposed to make us more productive and our lives easier. Instead, I feel like I spend more time waiting than coding.

One might ask why I find myself in a position to be composering and npming so often, that this is obviously a non-problem. Two reasons:

So I dug and dug until I found solutions, as one does, and now I’m sharing them with you.

Speeding up Composer

There are two things I’ve found to significantly improve Composer install/update speeds.

1. Disable Xdebug

Stack Overflow to the rescue here. Turn it off and be happy.

2. Use Prestissimo

Prestissimo is a global Composer plugin that installs dependencies in parallel. It is crazy fast. It’s worth noting that Prestissimo requires cURL, which may not work behind certain firewalls or proxies. I haven’t run into any issues at all personally.

I found 4 minute composer install times reduced to under 10 seconds.

Speeding up NPM

Unlike Composer, I’ve found no magic speed boosters for the Node dependency world, but rather two replacements:

ied/nom

ied (soon to be renamed nom) exists with the goal of covering 80% of the features and commands npm is used for on a daily basis. It features parallel installs, correct caching, and very nice package directory structure (one folder for each dependency vs hundreds).

I found 6 minute npm install times reduced to 22 seconds.

Because of the (purposely) missing features, you may not be able to use it on every project, but for me and my relatively normal use cases it works just fine.

You may find you need to npm rebuild node-sass and a few other dependencies once to get them to play nice because of the different directory structure. Keep that in mind, along with the fact that this is also still in alpha.

pnpm

Loosely based off ied, pnpm attempts to solve the same problem from a slightly different angle, while aiming to achieve compatibility with npm utilities like shrinkwrap. Using it will override the features it can improve upon, and pass others through to npm.

I found 6 minute npm install times reduced to 45 seconds.

I’ll add that the visual output is much nicer than both npm and ied/nom but I’ve seen a few snags with certain components. It’s still alpha. Keep an eye on it.

Happy speed increases!