-
-
Notifications
You must be signed in to change notification settings - Fork 244
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
Performance issue when frequently modifying view settings #431
Comments
Thank you for the detailed issue, but please, please, please follow the template. The details are fine, but please always attach the version info stuff. I require this from everyone as I am trying to standardize these issues to encourage good issues. And when all examples exhibit the same pattern, it encourages others to do so as well. Thanks. ---end rant---
This is definitely a new development since the introduction of ViewEventListener's. But it is possible this could be addressed. I'm not sure when I'll have the time to look into this though as I've been pretty busy recently. I'm a bit stretched by all the things I am maintaining and contributing to.
If you have a solution, I would encourage a pull request. Without looking into this, I can't say exactly how well simply using a generic global will work. Will I have to maintain a dictionary in which you index in per view id, and if so, require pruning of old view id's? Can I get away with a simple, single global variable? I'm not sure yet, and this will require further investigation. If this is becoming very troubling for you, a pull may get us there faster. |
My bad. I have edited the post and tried my best to match the template.
No problem. I appreciate you work to the ST community.
I am also not sure if a simple global will do the job properly. So I wanted to contact with you first to check if you have any insights. The situation is not that bad with a regular usage. But I could image it could be a problem if more packages are using ViewEventListener's given that BH is such a popular package. With that being said, I will look into this issue when I am free. |
Thanks for being understanding 🙂 .
Thanks!
Off the top of my head I am unfortunately not sure. I haven't had to touch that area in quite some time. I'd have to refresh myself to see if this is an issue. BH uses a normal EventListener, which I think only one is created per Window? I don't know if you can run the risk of multiple view's running the BH matcher simultaneously or not. I was probably being cautious and used the view settings as it would tell me if I was currently busy in that view, and I wouldn't have to prune it since it is destroyed along with the view. It is possible that can be simplified. I'll say this though, when executing a match, I do store that match info in the view setting as well, so this could still be an issue. I'm not sure if I have an easy solution for that. |
Performance issue when frequently modifying view settings
Recently I am working on a package with the following
sublime_plugin.ViewEventListener
And I notice that the method
is_applicable
is called exactly two times when I move the cursor. I thus changeprint("checked")
toprint(traceback.print_stack())
to see what functions are calling this frequently.It seems that every time I moved the cursor, BH changes the value of a view setting
bracket_highlighter.busy
twice, fromFalse
toTrue
thenFalse
again. Each change triggerssublime_plugin.check_view_event_listeners
and it then checks if all the ViewEventListener's are applicable to the current view.There is no problem for doing so, except when a user has a considerable large amount of
ViewEventListener's and each move will take a non-negligible a time / computer power to finish.
Support Info
Possible solution!?
BH should avoid using a view setting to flag its working status, may be a global variable?
The text was updated successfully, but these errors were encountered: