-
-
Notifications
You must be signed in to change notification settings - Fork 378
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
Unload once per linkable instead of once per splice #3390
Conversation
5ec2b6c
to
af2f579
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just my usual plea for documentation.
@@ -160,8 +160,7 @@ computePackageDeps env pkg = do | |||
|
|||
data TypecheckHelpers | |||
= TypecheckHelpers | |||
{ getLinkablesToKeep :: !(IO (ModuleEnv UTCTime)) | |||
, getLinkables :: !([NormalizedFilePath] -> IO [LinkableResult]) | |||
{ getLinkables :: !([NormalizedFilePath] -> IO [LinkableResult]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haddock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added.
@@ -1119,7 +1118,10 @@ getLinkableRule recorder = | |||
-- Record the linkable so we know not to unload it | |||
whenJust (hm_linkable =<< hmi) $ \(LM time mod _) -> do | |||
compiledLinkables <- getCompiledLinkables <$> getIdeGlobalAction | |||
liftIO $ void $ modifyVar' compiledLinkables $ \old -> extendModuleEnv old mod time | |||
liftIO $ modifyVar compiledLinkables $ \old -> do | |||
let !to_keep = extendModuleEnv old mod time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely some of the explanation you put in the PR description should be written in the code for future people?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, forgot to include the file. I've updated it now.
1cb8c91
to
41fd786
Compare
41fd786
to
5da533a
Compare
We need to unload old linkables before we can load in new linkables. However,
the
unload
function in the GHC API takes a list of linkables to keep (i.e.not unload). Earlier we
unload
ed right before loading in new linkables, whichis effectively once per splice. This can be slow as
unload
needs 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.