Unload once per linkable instead of once per splice#3390
Merged
Conversation
5ec2b6c to
af2f579
Compare
michaelpj
reviewed
Dec 12, 2022
Collaborator
michaelpj
left a comment
There was a problem hiding this comment.
Just my usual plea for documentation.
| = TypecheckHelpers | ||
| { getLinkablesToKeep :: !(IO (ModuleEnv UTCTime)) | ||
| , getLinkables :: !([NormalizedFilePath] -> IO [LinkableResult]) | ||
| { getLinkables :: !([NormalizedFilePath] -> IO [LinkableResult]) |
| compiledLinkables <- getCompiledLinkables <$> getIdeGlobalAction | ||
| liftIO $ void $ modifyVar' compiledLinkables $ \old -> extendModuleEnv old mod time | ||
| liftIO $ modifyVar compiledLinkables $ \old -> do | ||
| let !to_keep = extendModuleEnv old mod time |
Collaborator
There was a problem hiding this comment.
Surely some of the explanation you put in the PR description should be written in the code for future people?
Collaborator
Author
There was a problem hiding this comment.
Sorry, forgot to include the file. I've updated it now.
1cb8c91 to
41fd786
Compare
41fd786 to
5da533a
Compare
michaelpj
approved these changes
Dec 15, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We need to unload old linkables before we can load in new linkables. However,
the
unloadfunction in the GHC API takes a list of linkables to keep (i.e.not unload). Earlier we
unloaded right before loading in new linkables, whichis effectively once per splice. This can be slow as
unloadneeds to walk overthe list of all loaded linkables, for each splice.
Instead, now we unload old linkables right after we generate a new linkable and
just before returning it to be loaded. This has a substantial effect on recompile
times as the number of loaded modules and splices increases.