-
Notifications
You must be signed in to change notification settings - Fork 763
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
VS2017 RC - Colorization causing slow editing in large files #1821
Comments
@OmarTawfik I have a fix for this. Colorization is slow when the document text is changing in large documents. My understanding is that the table holding the FSharpColorization SourceTextData should be keyed by document or documentID (which doesn't change), rather than by document source text (which changes) |
Fix ready as part of #1829 |
Fixes #1821 Incremental colorization was not being effective on changing files for a number of reasons •Data cache was keyed by source text rather than document ID •We were writing None entries right through to end-of-file even when we could stop earlier •We weren't checking that start-of-line indexes and lex states were still the same when reusing entries •Tokenizers getting recreated for each line - we can cache these as well. I've tried the PR out on large files and it works much more efficiently. Also a fix to make ShouldTriggerCompletionAux faster in the common case where not pressing . This also fixes glyphs: #1806. Public/private/protected is not yet propagated to the glyph but this gives us feature parity with VS2015
For reference |
@Pilchie Thanks for reviewing these post-hoc. Can confirm we switched to DocumentID here https://github.com/Microsoft/visualfsharp/pull/1829/files#diff-de5bdafb119bed995860757094ee328eR61 |
Fixes dotnet#1821 Incremental colorization was not being effective on changing files for a number of reasons •Data cache was keyed by source text rather than document ID •We were writing None entries right through to end-of-file even when we could stop earlier •We weren't checking that start-of-line indexes and lex states were still the same when reusing entries •Tokenizers getting recreated for each line - we can cache these as well. I've tried the PR out on large files and it works much more efficiently. Also a fix to make ShouldTriggerCompletionAux faster in the common case where not pressing . This also fixes glyphs: dotnet#1806. Public/private/protected is not yet propagated to the glyph but this gives us feature parity with VS2015
If you open a large file (e.g. TypeChecker.fs or CompileOps.fs) then character-by-character editing is noticably slow, much slower than in VS2012-15.
The underlying problem is large CPU time usage by the routine
AddSyntacticClassificationsAsync
. Here are the top entries for a profiling run for 20 seconds of editing (this was using a debug build of Visual F# Tools, but the same results should apply to a release build )Repro steps
Open VisualFSharp.sln and go to COmpileOps.fs ot TYpeChecker,fs
Randomly delete characters and revert changes
Repeat this
Expected behavior
Fast editing
Actual behavior
Slow editing
Known workarounds
Use small code files :)
The text was updated successfully, but these errors were encountered: