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

CreateVisuals calling ITextSnapshot.GetText causes severe performance problems in large documents #31

Open
sharwell opened this issue Dec 21, 2022 · 3 comments

Comments

@sharwell
Copy link

🔗 Originally reported as https://developercommunity.visualstudio.com/t/visual-studio-very-slow-after-last-updat/10232726

The following code should not call GetText(). This method produces both a char[] and string representation of the document behind the scenes, leading to significant GC pressure and user-visible pauses in the UI.

https://github.com/chingucoding/IndentRainbow/blob/f360b230b8bf49c74007a3047cc3dec555b7e1ec/src/IndentRainbow.Extension/Classification/Indent.cs#L112-L131

@marcelwgn
Copy link
Owner

Thank you for creating this issue. Since you seem more knowledgeable in that area, what would you suggest would be a better solution? Is calling line.Snapshot.TextBuffer.CurrentSnapshot.GetText better?

@szalapski
Copy link

szalapski commented Oct 19, 2023

I wonder if I am hitting this too. Something seems to be freezing my editor (causing the window to fade out and eventually show the Windows "stopped responding" dialog) in VS Pro. I am not sure if it is IndentRainbow or not.

If you decide to try to fix this, I'd be willing to try it out. If not, thank you for the effort anyway. :)

@marcelwgn
Copy link
Owner

Thank you for your input @szalapski! Do you have a way one could reproduce this? For example is it a specific project or file? That would make it easier for me to debug this and find the right API for the job

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

No branches or pull requests

3 participants