Runing composer install
or composer update
on your Drupal 8 installation to install or update modules and themes could be sometimes frustrating because it can be very slow. Too slow in fact. But it doesn't have to be that way. Here are some tips to speed your Composer working with Drupal.
Install Prestissimo
Prestismo is a global composer plugin that that enables parallel installations and it's very fast! It can be more than 2x faster. But Prestissimo requires cURL, which may not work behind certain firewalls or proxies.
To install prestissimo follow these steps:
composer self-update
composer global require hirak/prestissimo
Once it is installed, Composer should install a new project much faster than before.
You can configure how many connections you would prefer, but I have found that the default of 6 seems to be pretty good.
To uninstall:
composer global remove hirak/prestissimo
Disable Xdebug?
Before Composer 1.3., Xdebug slowed down Composer substantially, sometimes making installs take 2-4x longer.
But with the newer versions of Composer (> 1.2.) this issue has been fixed. So be sure to update your Composer to the latest version with the command composer self-update
More info
Tired of Waiting (Jack McDade)
Improve Composer performance with Prestissimo (Pete Houston)
Speeding up Composer-based Drupal installation (Jeff Geerling)