ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.25k stars 361 forks source link

opam pin is very slow on windows #6048

Open hhugo opened 4 months ago

hhugo commented 4 months ago

opam pin is very slow on windows, are we cloning the entire repo, with all branches ? It take 1m20 for each package pinned.

Sat, 22 Jun 2024 13:10:59 GMT
Pin local packages
Sat, 22 Jun 2024 13:10:59 GMT
  C:\hostedtoolcache\windows\opam\2.2.0-rc1\x86_64\opam.exe pin --no-action add js_of_ocaml-compiler.dev .
Sat, 22 Jun 2024 13:12:21 GMT
  [js_of_ocaml-compiler.dev] synchronised (file://D:/a/js_of_ocaml/js_of_ocaml)
Sat, 22 Jun 2024 13:12:21 GMT
  js_of_ocaml-compiler is now pinned to git+file://D:/a/js_of_ocaml/js_of_ocaml#HEAD (version dev)
Sat, 22 Jun 2024 13:12:21 GMT
  C:\hostedtoolcache\windows\opam\2.2.0-rc1\x86_64\opam.exe pin --no-action add js_of_ocaml-lwt.dev .
Sat, 22 Jun 2024 13:13:43 GMT
  [js_of_ocaml-lwt.dev] synchronised (file://D:/a/js_of_ocaml/js_of_ocaml)
Sat, 22 Jun 2024 13:13:43 GMT
  js_of_ocaml-lwt is now pinned to git+file://D:/a/js_of_ocaml/js_of_ocaml#HEAD (version dev)
Sat, 22 Jun 2024 13:13:44 GMT
  C:\hostedtoolcache\windows\opam\2.2.0-rc1\x86_64\opam.exe pin --no-action add js_of_ocaml-ppx.dev .
Sat, 22 Jun 2024 13:15:06 GMT
  [js_of_ocaml-ppx.dev] synchronised (file://D:/a/js_of_ocaml/js_of_ocaml)
Sat, 22 Jun 2024 13:15:06 GMT
  js_of_ocaml-ppx is now pinned to git+file://D:/a/js_of_ocaml/js_of_ocaml#HEAD (version dev)
Sat, 22 Jun 2024 13:15:06 GMT
  C:\hostedtoolcache\windows\opam\2.2.0-rc1\x86_64\opam.exe pin --no-action add js_of_ocaml-ppx_deriving_json.dev .
Sat, 22 Jun 2024 13:16:31 GMT
  [js_of_ocaml-ppx_deriving_json.dev] synchronised (file://D:/a/js_of_ocaml/js_of_ocaml)
Sat, 22 Jun 2024 13:16:31 GMT
  js_of_ocaml-ppx_deriving_json is now pinned to git+file://D:/a/js_of_ocaml/js_of_ocaml#HEAD (version dev)
Sat, 22 Jun 2024 13:16:31 GMT
  C:\hostedtoolcache\windows\opam\2.2.0-rc1\x86_64\opam.exe pin --no-action add js_of_ocaml-toplevel.dev .

This is using opam 2.2 rc1

dra27 commented 4 months ago

Just extraction a clearer repro:

opam pin --no-action add js_of_ocaml-compiler.dev .
opam pin --no-action add js_of_ocaml-lwt.dev .
opam pin --no-action add js_of_ocaml-ppx.dev .
opam pin --no-action add js_of_ocaml-ppx_deriving_json.dev .
opam pin --no-action add js_of_ocaml-toplevel.dev .
dra27 commented 4 months ago

The issue here is that local Git repos are first rsync'd and this happens for each pin. You'll see if you pin git+https://github.com/ocsigen/js_of_ocaml.git that it's much faster (especially on the subsequent pins, because the commit cache starts to work).

This is related to #5810.

dra27 commented 4 months ago

(assigning @rjbou, as we can't remember why the rsync has to take place for a Git clone)

smorimoto commented 3 months ago

It seems to have been caused by Cygwin's local package directory being created in cwd, but setup-ocaml now tells git to ignore it. This should make the pin not very slow.