ipfs/aegir

Enable parallel script runs

wemeetagain opened this issue · 2 comments

Is your feature request related to a problem? Please describe.

The typical pattern for building packages in a monorepo is to add a "build": "aegir run build" script in the root package.json and add a "build": "aegir build" in each subpackage package.json.

This is slow because the run implementation currently executes scripts for each package sequentially, rather than running in parallel where it can.

Describe the solution you'd like
Enable run to execute in parallel where it can

Additional context

  • Small comparison:
    • building libp2p/js-libp2p monorepo takes 1m37s with 26 packages => avg 3.7s per package
    • building chainsafe/lodestar monorepo (using lerna which executes in parallel where possible) takes 54s with 19 packages => avg 2.8s per package
    • assuming similar amount of inter-monorepo dependencies and package complexity, with parallel script runs, building js-libp2p would drop to 1m12s, saving 25s per build

This in progress here: #1312

It needs some tests adding and I think interleaving the output of different processes got a bit hard to follow so that needs sorting out too.