-
Notifications
You must be signed in to change notification settings - Fork 217
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
Consider caching Alias & Command information #992
Comments
Ah, looks like we already do. PowerShellEditorServices/src/PowerShellEditorServices/Language/LanguageService.cs Lines 730 to 735 in 9358709
Maybe we should change the name of |
@SeeminglyScience Yeah nice find… still doesn’t look like the cache ever gets invalidated? And it’d be nice to have something similar for Commands for the Command Explorer and other operations. |
I think an easy "potential" win is simply breaking up the single async thread that reads and dispatches messages into two separate threads. One that reads messages from the client and queues them. The other thread would be essentially what we have to today but rather than read directly from the client, it reads from the PSES queue. The primary advantage is that the thread reading from the client could maintain a separate So yeah, I've done a prototype implementation of such a beast. And no, I'm not confident it is good to go as-is. It needs someone with more async-fu than me to check it over. I would have been more comfortable doing this not using async but hey, that's my limitation with server-oriented async. :-( The PR in question also adds some logging instrumentation to keep track of queue wait times (as can be seen by output from the PsesLogAnalyzer). You will notice that when using that PR (#832), there still can be quite long queue wait times but at least we are seeing reality here. With all the logging we've put in for timing requests e.g. completion request times, we have no idea how long that LSP message was sitting in the pipe before we read it and started processing it. Sorry to sound like a broken record but we really need to do something to process cancel requests IMO. I don't care at all if it's not the approach I've taken in PR #832. It just needs to happen ... somehow. :-) |
On second thought, that gets real complicated. At first glance it seems like that would help us avoid tying up the pipeline thread, but quite a few properties/methods on We'd have to create a flat version of
Actually I'm inclined to say that the message reader should be entirely sync. Especially with the whole custom My idea for threading in general is:
Though tbh, I'm tempted to say none of the project should be |
On every
textDocument/references
request and everytextDocument/codeLens
request, we rely on the pipeline to get the current available.This is time consuming and bottlenecked by the pipeline thread. As such, we should consider caching this result based on the state of the Integrated Console.
Coming off the the back of #980, one of the patterns I liked was the ability to tell if something was run in the PSIC using PSRL’s ENTER handler and F8’s handler.
Bringing this concept in, we can use it as a “Dirty” check where we cache aliases and command info results, and only refresh the cache when the PSIC is Dirty.
That way, for example, our
textDocument/references
request andtextDocument/codeLens
request only rely on the pipeline once the cache is Dirty and an otherwise run unblocked giving us a perf improvement.The text was updated successfully, but these errors were encountered: