-
Notifications
You must be signed in to change notification settings - Fork 267
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
Improve performance for large projects #4419
Improve performance for large projects #4419
Conversation
### Changes 1. Rename `LegacySymbolTable`, which is part of the non-LSP Dafny server, to `SuperLegacySymbolTable` 1. Rename `SignatureAndCompletionTable` to `LegacySignatureAndCompletionTable` 1. Let `SignatureAndCompletionTable` differentiate between positions in different files, so it doesn't get confused between symbols in different files when they have similar positions or ranges. 1. Only migrate state in `SignatureAndCompletionTable` that relates to the changed file ### Testing - There could be a test added for 3 but I didn't add it. - Merging this PR into this other PR (#4419), reduces the time of the test `ManyFastEditsUsingLargeFilesAndIncludes` from 47 seconds to 8 seconds <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
… only using one class
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.
Overall according to my understanding it looks good. A few questions there and there.
lowest = Math.Min(lowest, division); | ||
|
||
// Commented code left in intentionally | ||
await output.WriteLineAsync("openMilliseconds: " + openMilliseconds); |
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.
shouldn't we use logging here instead of all these output.WriteLineAsync?
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.
There's no logger
available inside the test files.
await output.WriteLineAsync("changeMilliseconds: " + changeMilliseconds); | ||
await output.WriteLineAsync("division: " + division); | ||
try { | ||
Assert.True(division < 10, |
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.
Can you please justify why this threshold? Also please consider introducing a constant at the top of the class
Co-authored-by: Mikaël Mayer <[email protected]>
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.
Can you confirm that the imports flagged as potentially not being used are in fact used or remove them? Should we add a test as suggested by Mikael?
var newRange = changeProcessor.MigrateRange(location.Range); | ||
if (location.Uri != documentChange.TextDocument.Uri) { | ||
return location; | ||
} |
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.
Can we add one?
### Changes 1. Rename `LegacySymbolTable`, which is part of the non-LSP Dafny server, to `SuperLegacySymbolTable` 1. Rename `SignatureAndCompletionTable` to `LegacySignatureAndCompletionTable` 1. Let `SignatureAndCompletionTable` differentiate between positions in different files, so it doesn't get confused between symbols in different files when they have similar positions or ranges. 1. Only migrate state in `SignatureAndCompletionTable` that relates to the changed file ### Testing - There could be a test added for 3 but I didn't add it. - Merging this PR into this other PR (dafny-lang#4419), reduces the time of the test `ManyFastEditsUsingLargeFilesAndIncludes` from 47 seconds to 8 seconds <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
### Changes - Sample sending notifications to the IDE, so at most one is sent every 100ms. Relatedly, `IdeState` is computed lazily, so it not computed for notifications that are not sent to the IDE. - Cancel ongoing compilation work and notification publishing immediately when UpdateDocument is entered - Start a new compilation slightly earlier, before computing the most recently changed ranges - Fix migration of recently changed ranges, so it properly accounts for Uri differences. - Make sure only one (correct) version of `WriterFromOutputHelper` is used in all test projects, to help in debugging non-deterministic failures - Small changes to `IncrementalVerificationDiagnosticsBetweenMethods` to help in debugging non-deterministic failures ### Testing - Add a test `QuickEditsInLargeFile` with a 1000 line and method file, that instantly makes a 100 small edits to that file, and asserts that the language server can process these changes in at most three times as much time as it takes to open the file. <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
### Changes 1. Rename `LegacySymbolTable`, which is part of the non-LSP Dafny server, to `SuperLegacySymbolTable` 1. Rename `SignatureAndCompletionTable` to `LegacySignatureAndCompletionTable` 1. Let `SignatureAndCompletionTable` differentiate between positions in different files, so it doesn't get confused between symbols in different files when they have similar positions or ranges. 1. Only migrate state in `SignatureAndCompletionTable` that relates to the changed file ### Testing - There could be a test added for 3 but I didn't add it. - Merging this PR into this other PR (#4419), reduces the time of the test `ManyFastEditsUsingLargeFilesAndIncludes` from 47 seconds to 8 seconds <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
### Changes - Sample sending notifications to the IDE, so at most one is sent every 100ms. Relatedly, `IdeState` is computed lazily, so it not computed for notifications that are not sent to the IDE. - Cancel ongoing compilation work and notification publishing immediately when UpdateDocument is entered - Start a new compilation slightly earlier, before computing the most recently changed ranges - Fix migration of recently changed ranges, so it properly accounts for Uri differences. - Make sure only one (correct) version of `WriterFromOutputHelper` is used in all test projects, to help in debugging non-deterministic failures - Small changes to `IncrementalVerificationDiagnosticsBetweenMethods` to help in debugging non-deterministic failures ### Testing - Add a test `QuickEditsInLargeFile` with a 1000 line and method file, that instantly makes a 100 small edits to that file, and asserts that the language server can process these changes in at most three times as much time as it takes to open the file. <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
Changes
IdeState
is computed lazily, so it is not computed for notifications that are not sent to the IDE.WriterFromOutputHelper
is used in all test projects, to help in debugging non-deterministic failuresIncrementalVerificationDiagnosticsBetweenMethods
to help in debugging non-deterministic failuresTesting
QuickEditsInLargeFile
with a 1000 line and method file, that instantly makes a 100 small edits to that file, and asserts that the language server can process these changes in at most three times as much time as it takes to open the file.By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.