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

More performance tweaks adaptive #1028

Closed

Conversation

TheAngryByrd
Copy link
Member

  • Incremental text changes + fixes
  • Completion Speed ups
  • Clear caches on project changes
  • Slightly more resilient around getting typechecks

Copy link
Member Author

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

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

This work is based onhttps://github.com//pull/1025 so might want to consider that one first

@@ -50,6 +50,7 @@ nuget YoloDev.Expecto.TestSdk
nuget AltCover
nuget GitHubActionsTestLogger
nuget Ionide.LanguageServerProtocol
nuget Microsoft.Extensions.Caching.Memory
Copy link
Member Author

Choose a reason for hiding this comment

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

We can use stale results for completions to get it to be super quick. However the compiler's TryGetRecentTypeCheck only keeps type checks for the specific sourcetext, which won't really matter for us because we'll be doing incremental type checking on DidChange already

@@ -227,14 +235,23 @@ type FSharpCompilerServiceChecker(hasAnalyzers) =
member __.ScriptTypecheckRequirementsChanged =
scriptTypecheckRequirementsChanged.Publish

/// This function is called when the entire environment is known to have changed for reasons not encoded in the ProjectOptions of any project/compilation.
member _.ClearCaches() =
Copy link
Member Author

Choose a reason for hiding this comment

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

Useful for major project changes like git checkout

let ops =
MemoryCacheEntryOptions()
.SetSize(1)
.SetSlidingExpiration(TimeSpan.FromMinutes(2.))
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if a time is really needed.


GC.Collect()
GC.WaitForPendingFinalizers()
Async.Start(
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving things to Async calls to allow type checks to come back faster. Not as strictly necessary anymore given our new method of completions.

@@ -930,16 +1064,28 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar
|> Result.ofOption (fun () -> $"No parse results for {filePath}")

let forceGetTypeCheckResults filePath =
let tyResults = getTypeCheckResults (filePath)
let rec doIt tryAgain =
Copy link
Member Author

Choose a reason for hiding this comment

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

If we don't get type check results for a file, assume we need to mark it out of date and try again.

@TheAngryByrd
Copy link
Member Author

quick-completions

Completions super fast (~30ms) in a 4k line file.

@TheAngryByrd
Copy link
Member Author

Closing in favor of #1036

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.

1 participant