Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

GC tweaks #329

Merged
merged 1 commit into from
Jan 17, 2020
Merged

GC tweaks #329

merged 1 commit into from
Jan 17, 2020

Conversation

pepeiborra
Copy link
Collaborator

ghcide uses a lot of memory in large codebases. In ours it starts at 7GB and goes up to 30GB quite easily. Needless to say, GC settings have a huge impact. Disabling the idle GC alone cuts up to 4s for hovers.

@ndmitchell
Copy link
Collaborator

I've used similar GC tweaks on Shake, and find they are usually super helpful.

Can you give any stats about your code base? I'm looking to use ghcide on a pretty huge codebase, and curious to know if it's going to work. I'm wondering if some kind of hi file, paging stuff out, is going to be required at larger sizes?

@pepeiborra
Copy link
Collaborator Author

We have ~1300 Haskell modules and 300 packages in the ghc pkg dB. Using ghc 8.6.5 so haven’t tried hie files yet, ghcide takes several minutes to boot

Some of us coming to the Bristol Hackathon are planning to work on reducing the memory usage by increasing sharing.

Copy link
Contributor

@aherrmann-da aherrmann-da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you, I've seen a small speed up due to these flags on the relatively small ghcide code base as well.

@aherrmann-da aherrmann-da merged commit 85b8377 into haskell:master Jan 17, 2020
@mpickering
Copy link
Contributor

@pepeiborra Have you done any space profiling to work out what the big memory hogs are?

@pepeiborra
Copy link
Collaborator Author

@mpickering I have collected some space profiles in our work repo which show that a large portion of the heap is used by GHC data structures, including Types and Spans.

Instead of sharing those though, it might be better to collect space profiles done on GHC itself. I've been trying to do that but given up on loading GHC in ghcide. Do you have any insights? See https://gitlab.haskell.org/pepeiborra/ghc/commit/4f4b83d261691fd6872218c9d68976cafb6b3267

@mpickering
Copy link
Contributor

@pepeiborra Why do your changes to the files not work?

@pepeiborra
Copy link
Collaborator Author

I got ghcide to load GHC successfully after deleting the .hie-bios folder. But now ghcide rebuilt with the profiling runtime is unhappy for some other reason.

@mpickering
Copy link
Contributor

You probably need to also enable profiling for the project you are trying to profile which would require modifying the hadrian build flavour to build profiling versions of the libraries.

pepeiborra added a commit to pepeiborra/ghcide that referenced this pull request Jan 19, 2020
pepeiborra added a commit to pepeiborra/ghcide that referenced this pull request Feb 1, 2020
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants