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

Slow start on Windows 7 for big folders (even on SSD) #413

Open
jakub-g opened this issue Feb 26, 2015 · 1 comment
Open

Slow start on Windows 7 for big folders (even on SSD) #413

jakub-g opened this issue Feb 26, 2015 · 1 comment

Comments

@jakub-g
Copy link
Contributor

jakub-g commented Feb 26, 2015

We use grunt watch in our project with a config like this:

  grunt.initConfig({
    watch: {
      sync: {
        files: ['src/folder1/**', 'src/folder2/**', 'src/folder3/**'],
        tasks: ['sync'],
        options: {
          debounceDelay: 250
        }
      }
   ...

  grunt.registerTask('default', ['watch:sync']);

Those 3 folders amount to ~3000 files.

When I run grunt, it immediately prints that it's watching/waiting:

$ grunt
Running "watch:sync" (watch) task
Waiting...

but in fact, it doesn't "see" the changed files for at least first 10-15 seconds after startup. I.e. I change some files, but the change is not detected and the callback is not fired. It starts being notified about file changes only after some 10-15 seconds from startup.

The folder is located on an SSD drive.

Is this a known issue?
Is this a limitation of Windows?

@jakub-g
Copy link
Contributor Author

jakub-g commented Jun 25, 2015

So the problem about "Waiting..." being displayed too early is related to #332 - it's displayed immediately instead of when ready callback is fired by gaze.

The fact about long startup time is linked to the number of files watched. Globbing itself takes only about 1.5 seconds, but it's probably on adding listeners phase when it's so slow, and probably linear with the number of files being watched.

To improve perf, I've done this:

  1. list explicitly files I am interested in, i.e.
 files: ['src/folder1/**']

->

 files: ['src/folder1/**/*.js', 'src/folder1/**/*.css']

is much more performant

  1. use 'cwd`:
files: ['very/long/path/**/*.js']

->

files: ['**/*.js'],
options: {
    cwd: 'very/long/path'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant