Closed maxmilton closed 6 years ago
Hello, @MaxMilton,
You can provide find . | wc -l
and tree -L 1
output for your __dirname
directory? I think you have a very large project directory. Also fast-glob@2
now faster then bash-glob
(it is possible that not in all cases).
The number of files in my project root is large, total dirs+files = 27405. Also the tree:
.
├── build
├── config
├── dist
├── index.html
├── jsconfig.json
├── node_modules
├── package.json
├── src
├── static
├── test
└── yarn.lock
7 directories, 4 files
Does fast-glob search the entire project from the __dirname? My specific use case is similar to this:
build/conf.js
:
fastGlob.sync([
path.join(__dirname, '../index.html'),
path.join(__dirname, '../src/**/*.vue'),
path.join(__dirname, '../src/**/*.js'),
]),
That's good to hear v2 is faster, obviously I haven't been able to test.
Thanks for provided details.
I'll work on your problem tonight. Now you can exclude node_modules
directory from reading by !**/node_modules
pattern. Also you can exclude dest
and other not needed directories.
Sorry for this situation.
Using your recommended excludes I'm able to run without any errors. For anyone else's reference, my updated and working code is:
fastGlob.sync([
'!**/node_modules',
'!**/dist',
path.join(__dirname, '../index.html'),
path.join(__dirname, '../src/**/*.vue'),
path.join(__dirname, '../src/**/*.js'),
]),
This is fine for me so feel free to close this issue.
After reading the documentation more closely I realised fast-glob starts the search from process.cwd()
so I was able to simplify things:
fastGlob.sync([
'!node_modules',
'!dist',
'index.html',
'src/**/*.vue',
'src/**/*.js',
]),
Thank you for your hard work on this project :1st_place_medal:
Well, I need to understand what's going on.
If you have free time, then tell me how much free memory you have on the server?
I checked work of this the package on directories with more than 500 000 files and it just works. But I have 16GB RAM and a heap of V8 has a size of 1.4 GB.
Maybe I can use a more intelligent index for occurrences or try to exclude the directories like .git
, node_modules
by default. So...
So, it's just a working theory. Maybe i'm wrong.
So, we well work on the solution here:
@MaxMilton,
Please, try to use npm i fast-glob@next --force
for your broken cases. I tried to fix the problem with large directories, temporarily switching to the readdir-enhanced
fork.
Sorry I hadn't gotten back to this thread sooner. I can confirm on the current v2.0.4
the issue I originally raised is no long reproducible.
Thank you for your hard work on this project! :star2:
Environment
Actual behavior
Since v2.0.0 an error is thrown when run on a filesystem. Number of files/dirs is 54/18 in my case.
Call stack:
Looks to be related to
readdir-enhanced
.Expected behavior
fast-glob
runs without any error thrown.Steps to reproduce
fast-glob
.Code sample
NOTE
Since v2.0.0 has removed bashNative mode, I'm actually going to pin my
fast-glob
version to 1.0.1 anyway since I want that native level of performance. That was actually the reason why I started using fast-glob in the first place!