janet-lang / jpm

Janet Project Manager
MIT License
72 stars 22 forks source link

Don't reclone and rebuild duplicate dependencies #82

Open tionis opened 1 year ago

tionis commented 1 year ago

Currently, when I have duplicate dependencies in my recursive dependency graph they are built multiple times. I suggest building the dependency tree first, and then maybe apply the algorithm in jpm/dag to build each only exactly once. Example:

But currently it looks more like this:

  1. clone & build spork
  2. clone & build B
  3. clone & build spork
  4. clone & build spork
  5. clone & build B
  6. clone & build C
  7. clone & build A
sogaiu commented 1 year ago

I agree it would be nice for the duplicate building to be reduced / eliminated.


Nice graph!

bakpakin commented 1 year ago

If the build system is doing it's job, this should really cause things to slow down very much since things shouldn't be rebuilt from scratch. Does this actually slow things down that much?

JPM lockfiles aim to fix this issue by installing all unique dependencies only once, in an order where all of a libraries dependencies are installed before it is installed.

sogaiu commented 1 year ago

@tionis Did you have a chance to try the new code from #85?

tionis commented 1 year ago

No, the two issues are currently not on top of my todo list so I haven't found time yet.

tionis commented 1 year ago

But I think the issue is less severe. Have to test some more in a clean env

tionis commented 1 year ago

I think it's mostly fixed. jpm still builds dependencies ofter than needed, but that only results in the files being copied into the package cache (i'm unsure on the terminology here) more than needed. Compilation and similar tasks are not duplicated anymore.

tionis commented 1 year ago

I'm unsure if I should close this, as the issue is technically not fixed.

sogaiu commented 1 year ago

Thanks for checking!

May be leaving it open is ok for now.