commercialhaskell / commercialhaskell/stack
Change type of PackageCacheMap to reduce index cache size
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
`Stack.Types.PackageIndex.PackageCacheMap` [is currently defined](https://github.com/commercialhaskell/stack/blob/a11c2c2c43f779c6fe7086a2e4c8d974305609a0/src/Stack/Types/PackageIndex.hs#L50) as
```
newtype PackageCacheMap = PackageCacheMap (Map PackageIdentifier PackageCache)
```
This means it's serialized in roughly following format:
```
"containers" "1.0.0" packageCache0
"containers" "1.0.1" packageCache1
"containers" "1.1.0" packageCache3
…
```
The package name is encoded again and again.
I'd therefore propose to change the type to either
```
Map PackageName (Map Version PackageCache)
```
or
```
HashMap PackageName (HashMap Version PackageCache)
```
depending on which of the two is faster to construct.
@mgsloan: Do you share my expectation that this new format would be faster to deserialize? Or am I possibly missing some aspect of `store` that could negate the benefits from the reduced cache size?
Contributor guide
Assessment
This issue has not been assessed yet.