Skip to content

Improve the performance of opam update/init on Windows#5966

Draft
kit-ty-kate wants to merge 18 commits intoocaml:masterfrom
kit-ty-kate:multicore-update
Draft

Improve the performance of opam update/init on Windows#5966
kit-ty-kate wants to merge 18 commits intoocaml:masterfrom
kit-ty-kate:multicore-update

Conversation

@kit-ty-kate
Copy link
Copy Markdown
Member

@kit-ty-kate kit-ty-kate commented May 21, 2024

WIP attempt at (temporary) fixing #5741 by throwing more silicon^Wdomains at the problem while #5648 is being worked on.

This currently requires:

Current result:

  • On Linux: opam update default goes from 6 seconds to 4 seconds
  • On Windows: opam init --bare goes from 6 and a half minutes to 3 minutes exactly. Of that 3 minutes, 1 minute is unchanged and taken by the extraction of the tar.gz archive.

Partly inspired by NTFS really isn't that bad - Robert Collins (LCA 2020)

Related to #5591
Fixes #3171
Fixes #4455
Fixes #2442

@kit-ty-kate kit-ty-kate added PR: WIP Not for merge at this stage AREA: PERFORMANCE labels May 21, 2024
@kit-ty-kate kit-ty-kate removed the PR: WIP Not for merge at this stage label May 22, 2024
@kit-ty-kate kit-ty-kate marked this pull request as ready for review May 22, 2024 16:21
@kit-ty-kate
Copy link
Copy Markdown
Member Author

The PR is now fully working as far as i tested.
However given the untested nature of this change, its presence in such a central piece of code and its reliance on big changes in underlying software (opam-file-format) I don't think it should be in 2.2 but i think it a good place to start to think about:

I'll split this PR into several smaller ones once 2.2.0 is out.

Comment on lines +46 to 47
let split_url u =
let re =
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually it's much easier to do this using domain local storage

Suggested change
let split_url u =
let re =
let split_url =
let re =
Domain.DLS.new_key @@ fun () ->

@kit-ty-kate kit-ty-kate added this to the 2.4.0~alpha1 milestone Sep 25, 2024
@kit-ty-kate kit-ty-kate removed this from the 2.4.0~alpha1 milestone Jan 20, 2025
@kit-ty-kate kit-ty-kate removed the request for review from rjbou January 20, 2025 17:37
Comment on lines +563 to +566
let log_mutex = Mutex.create ()
let log section ?(level=1) k =
Mutex.protect log_mutex @@ fun () ->
k @@ fun fmt ->
Copy link
Copy Markdown
Member Author

@kit-ty-kate kit-ty-kate May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might not be necessary if we replace the use of the default formatters by their OCaml5 Format.get_* counterparts. See ocaml/ocaml#10453

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants