Gulp: Extremely slow startup of nearly a minute

Created on 24 Mar 2016  Â·  9Comments  Â·  Source: gulpjs/gulp

Before I start I know this has been discussed in #282 #632 #1044 all of which are showing speed issues in the 1 - 5 seconds range - however I'm experiencing a startup time of _almost a minute_.

Gulpfile:

console.time("Loading plugins"); //start measuring

var gulp = require("gulp"),
    rimraf = require("rimraf"),
    concat = require("gulp-concat"),
    cssmin = require("gulp-cssmin"),
    uglify = require("gulp-uglify"),
    autoprefixer = require("gulp-autoprefixer"),
    changed = require("gulp-changed"),
    sass = require("gulp-sass"),
    debug = require('gulp-debug'),
    rename = require('gulp-rename');

console.timeEnd('Loading plugins');

gulp.task('default', function () { });

Output:

Loading plugins: 47812ms
[15:27:34] Using gulpfile M:\visual studio 2015\Projects\CustomerPortal\src\Cust
omerPortal\gulpfileSpeedTest.js
[15:27:34] Starting 'default'...
[15:27:34] Finished 'default' after 334 µs

Something is very wrong if it takes ~48 seconds to bring in 10 dependencies all of which my real gulpfile uses.

Gulp version: 3.8.11
CLI Version 1.2.1

wontfix

Most helpful comment

I have same problem, when run any task, some times (almost every times) it's take nearly a minute to startup gulp, then tasks running normal. And this happen only in Windows 10 machine (with SSD), in my Macbook everything running ok.

All 9 comments

It's node and npm, it has nothing to do with gulp (run node gulpfile.js and it will have the same times). Node requires are really really slow because it walks up and down the file system synchronously to find the module. The only solution is to get a nice SSD, or open an issue on node core asking them to optimize the require() function.

One of the idea how to solve this problem in theory.
https://medium.com/@Rich_Harris/how-to-not-break-the-internet-with-this-one-weird-trick-e3e2d57fee28#.ofn0cm9mp

@TrySound And then if someone wants to lock one of the dependencies in an already-released version of gulp to an older version because after release it turned out there was a bug in their case? They can't.

It's a bad idea. There's a reason we use tools like npm.

The solution to the problem is to lock your versions down and use a private mirror, if it's that important to you.

@callumacrae I meant not bundling deps, but only own project code. It can reduce a lot of requires.

Maybe not right article, but it contains that idea :)

I have same problem, when run any task, some times (almost every times) it's take nearly a minute to startup gulp, then tasks running normal. And this happen only in Windows 10 machine (with SSD), in my Macbook everything running ok.

Just to counter that it occurs on my Windows 7 machine, ran through VS15
Update 2

On 8 April 2016 at 16:59, Nguyen Van Anh [email protected] wrote:

I have same problem, when run any task, some times (almost every times)
it's take nearly a minute to startup gulp, then tasks running normal. And
this happen only in Windows 10 machine (with SSD), in my Macbook everything
running ok.

—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/gulpjs/gulp/issues/1578#issuecomment-207492827

Sent from:

This is an old issue, but for anyone encountering it, I have a similar problem.

Gulp starts up fine, until it has to start a watch task, in which case I was seeing 60 seconds duration over the usual 3 seconds. This happened after a change I made to an unrelated gulp task, so I suspected that it was my fault, however switching to another branch without that change and the long time still persisted.

I investigated and it looks like my SSD is at end of life as it has run out of extra blocks. I ran TRIM to try and remedy it - however it is just a temporary fix.
Luckily I know now and can safely get any non backed up data off the disk until it's eventual demise. Strange I had to find out through gulp though!

I am using surface pro 4 ( SSD ) , it is very slow ...
Same project on Macbook Pro works well , anyone have solution ? or at least open the issue ?

Was this page helpful?
0 / 5 - 0 ratings