-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
WIP: Boost performance #1673
WIP: Boost performance #1673
Conversation
I don't like the complicated throttler in panel_view so I reverted e803a44 and the previous throttler 2cd32b7. Now, 5284df0 and the new tip b76c6b0 have the same performance. I think all commits are safe, easy to grasp, except e30f67a is (maybe?) tricky. With the performance now we basically hit the wall (with warm cache), in that the low ms 5, 6, 8 are spent in |
Nifty. Are you ready for a review here or want to do more work first? |
This is good enough for review. Sure I can beautify and add some comments and better commit messages ... but I think this works and should be safe. |
Huh, I was under the impression that accessing settings via the ST API was essentially free. Maybe there is a trick to it, I'm not sure, it's been a while. Maybe So, yeah, looks good indeed. I like how you improved the panel view, it's actually a lot simpler to read whereas e803a44 was a bit much. I'll run with it for a few days, see if any errors turn up. |
I maybe go for the extra mile and open separate PRs here. Looks like these are good improvements/patches with clear boundaries. Also looks like that while we have on_lint_result which fires unconditionally we could just invent lint_result_changed. Usually a view doesn't need to update for the same result set. (This wasn't important for single file linters bc it is at least likely that the report changes for the file you're editing, but for multi file linters it is not so. You edit one file and the other ten files reported probably stay the same.) Don't need to do this immediately but it sounds reasonable. |
Note: Queries like `views_into_file` are expensive on the worker.
We completely cache the settings in memory. This surprisingly boosts performance because if we access `load_settings` from the worker or any other thread we often pay a synchronization penalty of multiple ms. (Then again these lookups are zero cost.) The old implementation was also too sloppy because `has_changed` could only be called once in `on_update` per key. (On the second call it returned always `False`.)
This partially reverts "2cd32b7 Throttle panel repaints" We revert the throttler introduces in 2cd32b7, but keep the nice refactoring around the `draw` function.
Computing `filenames_per_window` is relatively slow, so we try to avoid that if we can.
b76c6b0
to
789007a
Compare
No separate PR but I actually introduce 'lint_result_changed' bc that's really nicer and makes sense. Please look at LGTM |
Maybe something about multiple errors on a line, or otherwise overlapping regions? |
Good idea! The line comes from SL3 where the actual region was used to filter overlapping errors, but we just use the reported line for that now. |
I’ll try and put it through the ringer later today. Other than that the branch has been really solid for me. |
Ok, it looked good enough for what I tried now, but I need to try something more complicated with eslint. Will try to break it tomorrow and will report back. |
789007a
to
0f0822c
Compare
Ok, most of this looks and behaves well. I can't remember how to trigger overlapping multi-line errors. I seem to remember that happening with TSLint sometimes, but I haven't done any TypeScript for some time now and don't have any projects lying around. That said, there is one problem: the tooltips on the gutter no longer work. On the regions themselves they're fine but this doesn't work anymore (screenshot taken on master while hovering over the line number): |
You're really a good tester. 👏 👍 |
🙇🏼♂️ |
- For the gutter marks/icons we don't need to compute a line region. There is no visual difference if we just use the region we already have. - For the highlights, we extract the 'offending_text' in the backend using the virtual view which is just much faster.
- Skip for non lintable views - Actually only emit when there were any changes - Broadcast 'filename' instead of 'view' Notable: the body of this function is basically zero cost in Sublime although it looks like a lot is happening here. After broadcasting, a normal panel redraw will occur (if a panel is open).
0f0822c
to
5438924
Compare
Fixed. |
Nice! Let's 🛥 this! |
Workflow question: How do you checkout after I force-push? |
Well usually I just pull and then notice it doesn’t fast-forward. So then I switch to master, remove the branch, and checkout the branch again. |
🙌 (After force-push, I |
Wanna ship this now as a minor release? |
I'm on it right now |
🎉 |
Various performance commits.
Must be read commit by commit.
Solves #1623 for free in a pragmatic way: if the results change it will open the panel again. Otherwise the panel stays closed.
settings
are now generally cached in memory. Greatly improvessettings.has_changed
which was very cheap and idiosyncratic and now just works as anyone would expect.Introduces new event
lint_result_changed
which otherwise is the same as our known 'lint_result' with a cache in front. Notable: Since we usually rely on our settings as a global, t.i. we're never pure anywhere probably, we use a settings 'change-count' as additional cache salt.Fixes #1623
Fixes #1662
Fixes #1671