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

Simplify getting all package names and use itemCache in Browse #1049

Merged
merged 2 commits into from
Apr 7, 2022
Merged

Simplify getting all package names and use itemCache in Browse #1049

merged 2 commits into from
Apr 7, 2022

Conversation

ysangkok
Copy link
Member

@ysangkok ysangkok commented Apr 3, 2022

The first commit optimizes getting the list of all package names, by removing the highly inefficient toPackageNames and instead creating allPackageNames which uses the keys of a map instead of the values that toPackageNames was iterating over. This commit also introduces use of this new function in places where this is all we need.

The second commit optimizes the browse listing (i.e. not search), which was doing n map lookups using makeItemList, where n is the total amount of packages. This is now avoided by simply fetching pre-made PackageItems using getAllLists. The speedup may not be large since the construction of these PackageItems using makeItemList was already used in the search feature, and this branch wasn't reported to be slow.

Tested on my local Hackage instance, but not benchmarked properly yet.

@ysangkok ysangkok changed the title Simplify package index construction Simplify getting all package names and use itemCache in Browse Apr 3, 2022
@gbaz gbaz merged commit d4b6d45 into haskell:master Apr 7, 2022
@ysangkok ysangkok deleted the janus/faster-index branch April 7, 2022 17:39
@gbaz gbaz mentioned this pull request May 14, 2022
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