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

Improve performance of project file watch setup #2752

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

rtpg
Copy link
Contributor

@rtpg rtpg commented Mar 30, 2021

This improves performance through a couple of strategies:

  • Only check if a directory is an ignored directory once. Previously the filter was in multiple parts of the the chain.
  • When setting up watches, only generate a list of directories (as files end up getting filtered out later anyways)
  • Directly list directory contents when recursively fetching items, instead of relying on completion code

(See related discussion here)

@rtpg
Copy link
Contributor Author

rtpg commented Mar 30, 2021

I'm having a hard time understanding these test failures, looks like something is wrong with Emacs 26.x in my thing but I can't quite figure out what

Copy link
Member

@yyoncho yyoncho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I am still to perform manual testing.

@jcs090218 any idea why CI is red? Seems like we are fetching a package that depends on emacs 27.1 and all 26.x are failing?

lsp-mode.el Outdated
(lsp-log "Creating watch for %s" dir)
(when (or
(not warn-big-repo?)
(not lsp-file-watch-threshold)
(let ((number-of-files (length (lsp--directory-files-recursively dir ".*" ignored-directories t))))
(let ((number-of-files (length dirs-to-watch)))
(or
(< number-of-files lsp-file-watch-threshold)
(condition-case _err
(lsp--ask-about-watching-big-repo number-of-files dir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix the wording in that method because we are no longer counting files.

lsp-mode.el Outdated
(and (f-dir-p full-path)
(not (equal path "."))
(not (equal path ".."))
(not (lsp--string-match-any ignored-directories full-path))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always close the brackets on the same line, here and on a few more places in the PR.

 This improves performance through a couple of strategies:

 - Only check if a directory is an ignored directory once. Previously
 the filter was in multiple parts of the the chain.

 - When setting up watches, only generate a list of directories (as
 files end up getting filtered out later anyways)

 - Directly list directory contents when recursively fetching items,
 instead of relying on completion code
@rtpg
Copy link
Contributor Author

rtpg commented Apr 2, 2021

Sorry, forgot to comment but I went over the comments and tried to clean up the indentation and the naming (also updated the file warning to try and make it clearer that this is a directory count)

Copy link
Member

@yyoncho yyoncho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing to lsp-mode and sorry for the delay.

@yyoncho yyoncho merged commit f38a053 into emacs-lsp:master Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants