-
Notifications
You must be signed in to change notification settings - Fork 376
opam show: Reduce I/O when multiple versions of a package exist
#6818
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
base: master
Are you sure you want to change the base?
Conversation
…ed packages and their switch at once
'OpamGlobalState.fold_switches' and its derivatives are expensive functions in terms of I/O. In opam show, in particular, the switch selections were read for each version.
…installed packages and their switch at once
| ## List | ||
|
|
||
| ## Show | ||
| * Improve performance of `opam show` by reading switch selection only once instead of once per package-version [#6515 @dra27] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Improve performance of `opam show` by reading switch selection only once instead of once per package-version [#6515 @dra27] | |
| * Improve performance of `opam show` by reading switch selection only once instead of once per package-version [#6818 @dra27] |
|
|
||
| ## opam-state | ||
| * `OpamRepositoryState.load_opams_from_diff` track added packages to avoid removing version-equivalent packages [#6774 @arozovyk fix #6754] | ||
| * `OpamGlobalState.all_installed_versions`: was added [#6515 @dra27] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * `OpamGlobalState.all_installed_versions`: was added [#6515 @dra27] | |
| * `OpamGlobalState.all_installed_versions`: was added [#6818 @dra27] |
| ## opam-core | ||
| * `OpamCmdliner` was added. It is accessible through a new `opam-core.cmdliner` sub-library [#6755 @kit-ty-kate] | ||
| * `OpamUrl`: rename and expose `local_path` as `looks_like_local_path` [#5979 @kit-ty-kate] | ||
| * `OpamCompat.Map.add_to_list`: was added [#6515 @dra27] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * `OpamCompat.Map.add_to_list`: was added [#6515 @dra27] | |
| * `OpamCompat.Map.add_to_list`: was added [#6818 @dra27] |
|
|
||
| (** Returns the map of installed instances of the package name towards the list | ||
| of switches they are installed in *) | ||
| val installed_versions: 'a global_state -> name -> switch list package_map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep installed_versions? It is not used in the codebase, and sherlocode doesn't highlight any use
| gt OpamPackage.Set.empty | ||
|
|
||
| let installed_versions gt name = | ||
| let installed_versions_t gt ~cond = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last commit proposes a factorisation of the 2 functions
|
|
||
| let installed_versions gt name = | ||
| installed_versions_t gt | ||
| ~cond:(fun nv -> OpamPackage.Name.equal name (OpamPackage.name nv)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ~cond:(fun nv -> OpamPackage.Name.equal name (OpamPackage.name nv)) | |
| ~cond:(fun nv -> OpamPackage.Name.equal name nv.name) |
Extracted from #6515, authored by @dra27
I noticed with
opam show dunethat the switch selections of the switches are read in proportion to the number of versions being displayed. That creates both unnecessary I/O and GC pressure. [...] I'd countenance against hyping the performance improvement onopam showbecause it won't always show up that way!