Skip to content
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

Avoid parsing files if content has not changed #1031

Open
radeksimko opened this issue Aug 9, 2022 · 0 comments
Open

Avoid parsing files if content has not changed #1031

radeksimko opened this issue Aug 9, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@radeksimko
Copy link
Member

radeksimko commented Aug 9, 2022

Background

This is another (different) attempt at improving performance which follows an earlier abandoned attempt captured in #989 - Using ModTime would not be reliable and also we would have no way of capturing ModTime for the virtual documents anyway! 😅

As part of #1006 we are removing de-duplication of jobs upon enqueuing and instead starting to rely on internal state. This is good strategy for the walker, which can check the internal state (i.e. avoid running if the job has already run at least once), but not so much for textDocument/didOpen.

In an ideal case the client would tell the server as part of LSP whether the document being sent in textDocument/didOpen differs from what's on disk. Unfortunately this is not possible today. The request does contain document version, but that's always 1 (at least from testing with VS Code) regardless of whether I open document w/ unsaved changes or not.

Therefore the work of figuring out the difference is left on the server.

See also:

Proposal

TODO: add logic to calculate hash (sha256) for any file & compare hashes of newly received document content as part of ParseVariables and ParseModuleConfiguration - then return StateNotChangedErr early. Check for that error in downstream jobs and avoid running those downstream jobs if upstream returned that error.

@radeksimko radeksimko added the enhancement New feature or request label Aug 9, 2022
@radeksimko radeksimko changed the title Avoid parsing files if contents has not changed Avoid parsing files if content has not changed Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant