-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
DidChangeTextDocument
notification is slow to process and may block
#13538
Comments
internal: Optimize `apply_document_changes` a bit cc #13538
cc @roife , I think you were looking into speeding this up? or was that something else |
I have tried placing the
I have considered using SIMD to accelerate the search process for |
We can probably use the |
I just tried using
It is worth noting that I use a brute-force algorithm in |
That looks very promising, optimizing seems enough to me. Offloading that to another thread is too complicated (and likely does not yield much in terms of benefits) |
Is that on ARM? Because I don't see a NEON implementation in |
Yes, I'm working on Apple Silicon.
It added support for neon just months ago🙈: BurntSushi/memchr#129 |
TIL |
…r, r=Veykril internal: speedup LineEndings calculation using 'memchr' See #13538
We handle client to server notifications synchronously, which means we should make sure that these notifications are processed fast as otherwise the server will block on them. If a user opens a very large rust file (100k+ lines) they will start encountering overly long loop and the general editor experience becomes very laggy. We can't make the processing for this notification async unfortunately so we should try and optimize the things we do there instead.
Relevant code snippets:
rust-analyzer/crates/rust-analyzer/src/main_loop.rs
Lines 746 to 768 in bbcb77e
rust-analyzer/crates/rust-analyzer/src/lsp_utils.rs
Lines 135 to 183 in bbcb77e
rust-analyzer/crates/ide-db/src/line_index.rs
Lines 57 to 94 in bbcb77e
The main part here is the
LineIndex
calculation as we have to traverse the entire document text character by character, so we should look into possibly optimizing the creation of it.The text was updated successfully, but these errors were encountered: