installedPkgs is duplicated for every component

Open
#12,565 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Active
Tech stack
haskell
Domain
build-system

Research direction

Start by reading the definitions of ComponentBuildDescr and LocalBuildInfo, then trace where installedPkgs is populated and consumed. The issue describes duplicated InstalledPackageInfo values but leaves the storage design open; first map the relevant lookups and shared computations. Done means proposing and implementing a design that removes duplication while preserving efficient shared lookups.

Written by the indexing model from the issue text.

Description

Cabal: other re: installed-package-info re: package index type: bug

In a somewhat similar vein to #12463, the installedPkgs field of ComponentBuildDescr (stored within LocalBuildInfo) holds the full InstalledPackageInfo of every installed package in the component's transitive external dependency closure.

This is a huge amount of duplication given that many dependencies are shared across components.

One idea would be to simply store UnitIds and defer all lookups, but that means everyone pays a bit of a performance cost especially as these are computations that we want to be shared.

Instead I think we should figure out how to store all InstalledPackageInfos in a way that avoids all duplication. It's not fully clear to me how to achieve this, however; some kind of package-wide store? But then we are re-inventing ghc-pkg so perhaps we can achieve this by improving ghc-pkg instead?

Dominant language
Haskell
Stars
1.8k
Forks
766
Avg merge
5d 21h
Merged PRs (30d)
27

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from haskell/cabal

All issues in haskell/cabal

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.