-
Notifications
You must be signed in to change notification settings - Fork 156
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
Reduced memory consumption of autocompletion cache #1077
Conversation
@@ -36,7 +36,7 @@ type FSharpCompilerServiceChecker(hasAnalyzers) = | |||
// This is used to hold previous check results for autocompletion. | |||
// We can't seem to rely on the checker for previous cached versions | |||
let memoryCache () = | |||
new MemoryCache(MemoryCacheOptions(SizeLimit = Nullable<_>(2000L))) | |||
new MemoryCache(MemoryCacheOptions(SizeLimit = Nullable<_>(200L))) |
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.
200 might still be too much. Someone could edit 200 files within 5 minutes and want autocompletions for them all but seems unlikely.
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.
nit - surface as a config option? maybe something like FSharp.fsac.cachedTypeCheckCount
?
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.
Done
This lets the caller of ParseAndCheckFileInProject determine if it should cache type checks for autocompletions. Typically we don't want to store them for anything other the already open files.
aeef1ff
to
dc66178
Compare
@@ -36,7 +36,7 @@ type FSharpCompilerServiceChecker(hasAnalyzers) = | |||
// This is used to hold previous check results for autocompletion. | |||
// We can't seem to rely on the checker for previous cached versions | |||
let memoryCache () = | |||
new MemoryCache(MemoryCacheOptions(SizeLimit = Nullable<_>(2000L))) | |||
new MemoryCache(MemoryCacheOptions(SizeLimit = Nullable<_>(200L))) |
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.
nit - surface as a config option? maybe something like FSharp.fsac.cachedTypeCheckCount
?
Thank you! |
Previously, on save, we would cache all typechecks. This could cause large solutions to use a lot of memory for no real purpose. This lets the caller of ParseAndCheckFileInProject determine if it should cache type checks for autocompletions. Typically we don't want to store them for anything other the already open files.