Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy files instead of rsync when they are in a local cache #4270

Merged
merged 2 commits into from
Jul 15, 2020

Conversation

kit-ty-kate
Copy link
Member

This PR is just to upstream a change I've been using in https://github.com/kit-ty-kate/opam-health-check.
This change improves slightly the time it takes to retrieve archives from a local cache by avoiding a rather unnecessary call to rsync from the cache to a temporary file (which is then going to be moved to the global download cache in ~/.opam/download-cache), and replacing it by the OpamSystem.copy_file function improved in this wonderful PR: #4064

This PR approximatively improves the time it takes to retrieve archive by 0.02s per archive in cache on my test server. In my use-case (CI), opam is repetitively called and thus repetitively retrieve archive from the cache.
On a typical medium sized-example: core.v0.14.0 for instance pulls 59 archives, so in total this PR make us gain 1.13s in this build. Multiply by 10_000 packages and this is now significant.

This was tested and timed with master + #4071 for simplicity and to avoid noise in the timing. (cc @Armael in case you want a simple-to-use commit to rebase #4071 you can use this one: kit-ty-kate@ac20d2f)

Just to avoid confusion, I know I could directly move (or link) the entire cache to ~/.opam/download-cache for an extra second of gain per 50 archives, but this is less composable and this PR is still an improvement nonetheless.

src/repository/opamRepository.ml Outdated Show resolved Hide resolved
@rjbou
Copy link
Collaborator

rjbou commented Jul 10, 2020

Minimal changes, but lgtm. thanks!

@kit-ty-kate kit-ty-kate force-pushed the cp-local-cache branch 2 times, most recently from 66c3b02 to bcf4fea Compare July 10, 2020 14:35
@rjbou rjbou added this to the 2.1.0~alpha2 milestone Jul 10, 2020
@rjbou rjbou merged commit 5fd171e into ocaml:master Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants