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

File search slow with many excluded files #11874

Closed
YuJianrong opened this issue Sep 12, 2016 · 7 comments
Closed

File search slow with many excluded files #11874

YuJianrong opened this issue Sep 12, 2016 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority search Search widget and operation issues

Comments

@YuJianrong
Copy link

  • VSCode Version: Code 1.5.1 (07d663d, 2016-09-08T21:27:44.726Z)
  • OS Version: Darwin x64 15.6.0

Steps to Reproduce:

1.Open a large project with many files
2.Click CMD+P to open fie file pick-up window
3.Input the file name
4.No file listed, loading bar is animating
5.I had noticed 12 processed are created on background with process name "find"

@bpasero bpasero added the important Issue identified as high-priority label Sep 13, 2016
@chrmarti
Copy link
Contributor

@YuJianrong Could you run time (find -L . -type f | wc -l); echo $? in your project folder and paste the output here?

@YuJianrong
Copy link
Author

1587724

real 0m20.528s
user 0m1.375s
sys 0m16.036s
0

Some information may be helpful:
I'm working on a project which many node modules are installed, and **/node_modules files are excluded so the installed node modules should not be picked or searched.
The file pick up feature works pretty fast before I upgrade to the new version.

@chrmarti
Copy link
Contributor

Thanks @YuJianrong.

One of my changes switched to using 'find' and the exclusion filters are then applied only on the output of that.

A possible fix would be to use -prune, like: time (find . \( -path '*/third_party' -o -path '*/chrome' \) -prune -o -type f | wc -l) (works on OSX, would need to test under Linux)

The bug that multiple find processes can run concurrently is tracked by #11181.

@chrmarti chrmarti changed the title OSX: Go to File pick up file very slow File search slow with many excluded files Sep 13, 2016
@Tyriar
Copy link
Member

Tyriar commented Sep 13, 2016

This is the relevant part of the man page for find that ships with Ubuntu 16.04:

       -path pattern
              File name matches shell pattern pattern.  The metacharacters  do
              not treat `/' or `.' specially; so, for example,
                        find . -path "./sr*sc"
              will  print an entry for a directory called `./src/misc' (if one
              exists).  To ignore a whole directory tree,  use  -prune  rather
              than  checking every file in the tree.  For example, to skip the
              directory `src/emacs' and all files and  directories  under  it,
              and  print the names of the other files found, do something like
              this:
                        find . -path ./src/emacs -prune -o -print
              Note that the pattern match test applies to the whole file name,
              starting from one of the start points named on the command line.
              It would only make sense to use an absolute path  name  here  if
              the  relevant  start point is also an absolute path.  This means
              that this command will never match anything:
                        find bar -path /foo/bar/myfile -print
              Find compares the -path argument with  the  concatenation  of  a
              directory  name  and  the  base name of the file it's examining.
              Since the concatenation will never end with a slash, -path argu‐
              ments  ending  in  a  slash will match nothing (except perhaps a
              start point specified on the command line).  The predicate -path
              is  also  supported  by  HP-UX find and will be in a forthcoming
              version of the POSIX standard.

Version info:

❯ find --version
find (GNU findutils) 4.7.0-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)

@chrmarti chrmarti added bug Issue identified by VS Code Team member as probable bug search Search widget and operation issues labels Sep 13, 2016
@chrmarti
Copy link
Contributor

It turns out that we can apply the **/something exclusions with the faster -name, all other exclusions could still be applied after 'find', e.g.: time (find -L . -not ( ( -name folder1 -o -name folder2 ) -prune ) -type f | wc -l)

@chrmarti
Copy link
Contributor

Fixed: 50bb7aa

@seansfkelley
Copy link

Thanks for fixing this! I eagerly await the next release, as I hit this issue pretty hard and can't use VS Code because of it. :(

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority search Search widget and operation issues
Projects
None yet
Development

No branches or pull requests

5 participants