Speeding Up Node Dependency Installs With Yarn

At the time of Yarn’s debut, it brought big advancements to npm’s performance and workflow along with the introduction of lock files. A lot of time has passed since then and with the arrival of a native npm lock file, I was under the impression that more recent npm development had rendered the benefits of Yarn obsolete.

I was proven wrong. Recently, while optimizing a build process for a site we identified the theme build as the step that was taking the longest amount of time, it didn’t take much digging to determine that npm install was the biggest culprit. After discovering a recently published article, Speeding up npm install in CI (February 2019), it became apparent that utilizing yarn install instead of npm install could yield speed improvements in the neighborhood of 90%, with even further benefits in environments where node dependencies were unchanged since the last build.

Thank you to the Yarn team and Eli Weinstock-Herman for compiling and publishing the benchmarks that helped save us a boat-load of time.