browser-sync: Extreme High CPU Usage

I am using Windows 7 64bit on AMD Phenom II X4 955 Processor PC and I try to run browser-sync using gulp.

    var gulp = require('gulp');
    var browserSync = require('browser-sync');
    gulp.task('browser-sync', function() {
    browserSync({
        server: {
            baseDir: "public"
        },
        files: "public/**",
        notify: false,
        browser: "chrome"
    });
    });

The problem is as soon as i run browser-sync, I see high CPU usage of about 60-70% on all 4 cores of CPU on node.exe all time. Do you experience such problem as well? Why is it run at such a high usage? Is there anyway to reduce it?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

I also faced with high CPU usage problem when tried to watch all my project files like so: gulp.watch('**/*.*', ['js']);dont use this! So the solution for me was to only watch the files that are changed regularly. Thanks to @christianv http://denbuzze.com/post/5-lessons-learned-using-gulpjs/

Why is it run at such a high usage? Is there anyway to reduce it?

Yeah, you need to be more specific with your file-watching. Instead of "public/**" try narrowing it down and exclude all vendor directories (such as bower_components, etc)

browserSync({
        server: {
            baseDir: "public"
        },
        files: ["public/js/*.js", "public/css/*.css"],
        notify: false,
        browser: "chrome"
    });

etc, etc.