cyrusfirheir / twee3-language-tools

[ VSCode extension ] Syntax highlighting and programmatic language tools for Twee 3, and Twine 2 storyformats.
https://marketplace.visualstudio.com/items?itemName=cyrusfirheir.twee3-language-tools
MIT License
47 stars 15 forks source link

Slow typing in large file in large project #79

Open DutchEllie opened 2 years ago

DutchEllie commented 2 years ago

Hi, when I use this extension to help me with writing it shows significant slowdowns when typing in a large file. The file is approximately 1000 lines long, but the slowdown occurs at a couple hundred lines too. This happens specifically in a very large project, with about 7700 passages. When all the passages are loaded, the performance is horrible, but when the passages are still loading and only about 100 are loaded, the performance is great. Therefore I think it has something to do with the amount of loaded passages. Is there anything that can be done about this?

I use Linux kernel 5.15.13-arch1-1 using Arch Linux.
I run KDE Plasma 5.23.5 on X11 (not sure if that's important at all).
I run VSCode version 1.63.2 from the visual-studio-code-bin package from the AUR.
This is happening on a Lenovo ThinkPad L15 G2 AMD, which has a Ryzen 7 Pro 5850U and 16GB of RAM.

I don't know what more information to provide right now. Do not hesitate to ask me for any more information. Thanks for developing this awesome project!

Tranberry commented 2 years ago

curious; does this happen even when you do not have passage listing turned ON?

image

DutchEllie commented 2 years ago

I have not disabled that in the settings.json but I did try to disable it once to see if the problem would go away, it didn't.

MinusGix commented 2 years ago

The best thing to do to isolate it is by turning off certain settings and then reloading vscode (Ctrl + P -> Reload can make it faster than completely turning it off and on), try:

It might be one of those, since they're some of the more expensive operations. Though, they haven't been optimized nearly as much as they could be, so if I can isolate it then that can help in improving things.
I should probably generate a large project with random macros + lorem ipsum to make it easier to notice and find performance issues, since there isn't an open source ones for me to test with.

DutchEllie commented 2 years ago

I will try the suggestions you made and report back as soon as I can.

DutchEllie commented 2 years ago

I got it! The issue disappeared entirely when I set twee3LanguageTools.sugarcube-2.error.argumentParsing to false. For sanity, when I set it back to true the problem returns and setting it to false again fixes it immediately!

Also, if you need the project to test on, the project I have this issue with is open source, but I am slightly anxious to share it publicly. It's not exactly the kind of project I need to be associated with... We are talking about an extension for a story writing engine of course. The limits of insanity are a bit higher in fiction sometimes

MinusGix commented 2 years ago

but I am slightly anxious to share it publicly. It's not exactly the kind of project I need to be associated with...

Yeah, I get that, there's a good amount of projects on the Twine Game Discord that one might be hesitant to associate with one's public profile. I actually remembered one relatively large project (which may actually be what you're referring to) that I can test on, which I had forgotten was open-source.
Hopefully I'll be able to improve the speed of that part of the code so it works better.