Gulp so slow on Mac

Hi,
I noticed that launching the gulp command it takes a lot of time! In the best case it takes like 40 seconds, in the worst one 1 minute! Comparing with my colleague that use Ubuntu, he waits only 10 seconds or less.

I’m on MacBookPro quad core i7 2.2Ghz - 4GB - SSD drive, then not that poor machine.

Notice that Grunt was a lot more fast!

Is it normal that gulp is so slow? It’s frustrating to waiting all this time. Let me know
thanks

That doesn’t sound right at all to me. I’m working on quite a large project and whilst using gulp watch, saving a stylesheet takes around 3 seconds and saving main.js takes about 5 seconds. A full gulp build takes around 10-12 seconds.

I’m on a Macbook Pro (mid-2014) 2.2GHz quad i7, 16gb RAM and SSD. The main difference in our machines seems to be RAM but then I don’t think gulp really consumes much RAM, although 4GB is very low – my machine uses around 4GB whilst idle!

What are your times like when using gulp watch?

Nope, not really. I’ve heard of issues with Windows being slow, but not so much on OS X or Linux. What @nathobson mentioned might be the issue, I think node.js can be a bit of a memory hog. Unfortunately it’s not so easy trying out adding more RAM :sweat_smile:

@nathobson I think that’s not a Ram issue, too. In gulp watch mode I have 5 seconds for scss compilation and 10 seconds for scripts. Not very very bad, as the full build. Have you any idea?

Hummm. So if your gulp watch times aren’t too bad on compiling down styles and scripts, then I guess you must have some assets outside of that scope that is causing the long times. When you run gulp and you get the 1 minute wait, can you see it hanging up on any particular part of the process in terminal i.e. images or fonts?

Oh yes, sorry if I was not so clear. The long wait (50secs) on full build starts from the launch of gulp to the first task. After the tasks start, it takes 10-15 seconds. Here the details:

$ gulp
-------> here is a wait of 50 seconds, then starts the tasks:
[18:53:26] Using gulpfile /path/gulpfile.js
[18:53:26] Starting ‘clean’…
[18:53:26] Finished ‘clean’ after 123 ms
[18:53:26] Starting ‘default’…
[18:53:26] Starting ‘build’…
[18:53:26] Starting ‘wiredep’…
[18:53:29] Finished ‘default’ after 2.92 s
[18:53:29] Finished ‘wiredep’ after 3.11 s
[18:53:29] Starting ‘styles’…
[18:53:32] gulp-autoprefixer:
autoprefixer: /editor-style.css:8314:3: Gradient has outdated direction syntax. New syntax is like “to left” instead of “right”.
[18:53:34] gulp-autoprefixer:
autoprefixer: /main.css:8570:3: Gradient has outdated direction syntax. New syntax is like “to left” instead of “right”.
[18:53:34] Finished ‘styles’ after 5.58 s
[18:53:34] Starting ‘jshint’…
[18:53:35] Finished ‘jshint’ after 410 ms
[18:53:35] Starting ‘scripts’…
[18:53:43] Finished ‘scripts’ after 7.92 s
[18:53:43] Starting ‘fonts’…
[18:53:43] Starting ‘images’…
[18:53:43] gulp-imagemin: Minified 1 image (saved 437 B - 25%)
[18:53:43] Finished ‘images’ after 172 ms
[18:53:43] Finished ‘fonts’ after 234 ms
[18:53:43] Finished ‘build’ after 17 s

OK, not too sure in that case. However, I did find this: gulp is sometimes slow to start · Issue #632 · gulpjs/gulp · GitHub. RAM was raised in this issue on Github. Is there any chance you could close down as many applications/processes as possible and run gulp alone with as much RAM available as possible just to test that out? Maybe post up a screengrab of your memory tab in Activity Monitor?

Hi @nathobson and thanks for helping me.

Well, these logs generated with gulpt could helps?

Build with all my apps opened

Start time: (2015-07-23 09:54:18 UTC) [treshold=1%,sorted]
# [order]  module                                   time  %
 1 [4853]  /path/....js (gulpfile.js)  38.2s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 68%
 2 [2675]  gulp-imagemin (nod...magemin/index.js)   5.2s  ▇▇▇▇ 9%
 3  [983]  browser-sync (node...er-sync/index.js)   4.6s  ▇▇▇▇ 8%
 4  [977]  ./lib/browser-sync.../browser-sync.js)   4.6s  ▇▇▇▇ 8%
 5 [2673]  imagemin (node_mod...magemin/index.js)     4s  ▇▇▇ 7%
 6 [3582]  gulp-less (node_mo...lp-less/index.js)   3.7s  ▇▇▇ 7%
 7 [3941]  gulp-minify-css (n...ify-css/index.js)   2.5s  ▇▇ 4%
 8 [5212]  wiredep (node_modu...redep/wiredep.js)   2.3s  ▇▇ 4%
 9 [1864]  gulp (node_modules/gulp/index.js)        2.3s  ▇▇ 4%
10 [3009]  gulp-jshint (node_...int/src/index.js)   2.2s  ▇▇ 4%
11  [461]  gulp-autoprefixer...refixer/index.js)      2s  ▇▇ 3%
12 [4291]  gulp-rev (node_mod...ulp-rev/index.js)   1.9s  ▇▇ 3%
13  [880]  ./sockets (node_mo...c/lib/sockets.js)   1.8s  ▇▇ 3%
14  [878]  socket.io (node_mo...cket.io/index.js)   1.8s  ▇▇ 3%
15  [877]  ./lib (node_module....io/lib/index.js)   1.8s  ▇▇ 3%
16 [4766]  asset-builder (nod...builder/index.js)   1.7s  ▇▇ 3%
17 [5154]  bower-config (node...ig/lib/Config.js)   1.7s  ▇▇ 3%
18 [4765]  ./lib/Manifest.js.../lib/Manifest.js)    1.7s  ▇▇ 3%
19 [2470]  vinyl-fs (node_mod...inyl-fs/index.js)   1.6s  ▇▇ 3%
20 [4097]  gulp-plumber (node...plumber/index.js)   1.6s  ▇▇ 3%
21 [4504]  gulp-sass (node_mo...lp-sass/index.js)   1.6s  ▇▇ 3%
22 [4764]  main-bower-files (...r-files/index.js)   1.4s  ▇ 3%
23 [4763]  ./lib (node_module...les/lib/index.js)   1.4s  ▇ 3%
24  [560]  ./async-tasks (nod...b/async-tasks.js)   1.4s  ▇ 3%
25 [4230]  gulp-util (node_mo...lp-util/index.js)   1.4s  ▇ 2%
26  [559]  ./async (node_modu...ync/lib/async.js)   1.4s  ▇ 2%
27  [557]  ./utils (node_modu...ync/lib/utils.js)   1.4s  ▇ 2%
28 [3907]  gulp-util (node_mo...lp-util/index.js)   1.4s  ▇ 2%
29 [2836]  ./reporters (node_...porters/index.js)   1.4s  ▇ 2%
30 [4096]  gulp-util (node_mo...lp-util/index.js)   1.4s  ▇ 2%
31 [1410]  gulp-concat (node_...-concat/index.js)   1.3s  ▇ 2%
32 [1566]  gulp-flatten (node...flatten/index.js)   1.3s  ▇ 2%
33 [1214]  gulp-changed (node...changed/index.js)   1.3s  ▇ 2%
34 [4678]  gulp-uglify (node_...-uglify/index.js)   1.3s  ▇ 2%
35 [3205]  gulp-util (node_mo...lp-util/index.js)   1.3s  ▇ 2%
36 [3581]  less (node_modules...es/less/index.js)   1.2s  ▇ 2%
37 [4852]  del (node_modules/del/index.js)          1.2s  ▇ 2%
38 [3580]  ./lib/less-node (n...ss-node/index.js)   1.2s  ▇ 2%
39 [1863]  vinyl-fs (node_mod...inyl-fs/index.js)   1.2s  ▇ 2%
40 [4431]  gulp-util (node_mo...lp-util/index.js)   1.2s  ▇ 2%
41 [1565]  gulp-util (node_mo...lp-util/index.js)   1.1s  ▇ 2%
42 [1190]  gulp-util (node_mo...lp-util/index.js)   1.1s  ▇ 2%
43 [2806]  gulp-util (node_mo...lp-util/index.js)   1.1s  ▇ 2%
44 [2419]  ./lib/src (node_mo...lib/src/index.js)   1.1s  ▇ 2%
45 [2083]  gulp-util (node_mo...lp-util/index.js)   1.1s  ▇ 2%
46 [1369]  gulp-util (node_mo...lp-util/index.js)  953ms  ▇ 2%
47 [1707]  gulp-util (node_mo...lp-util/index.js)  937ms  ▇ 2%
48  [139]  gulp-util (node_mo...lp-util/index.js)  877ms  ▇ 2%
49  [554]  serve-static (node...-static/index.js)  852ms  ▇ 2%
50  [840]  socket.io-client (...-client/index.js)  841ms  ▇ 1%
51  [839]  ./lib/ (node_modul...ent/lib/index.js)  806ms  ▇ 1%
52  [552]  send (node_modules...es/send/index.js)  801ms  ▇ 1%
53 [3000]  ./extract (node_mo...t/src/extract.js)  787ms  ▇ 1%
54 [1817]  ./lib/src (node_mo...lib/src/index.js)  778ms  ▇ 1%
55  [459]  autoprefixer-core.../autoprefixer.js)   748ms  ▇ 1%
56 [3775]  clean-css (node_mo...ean-css/index.js)  746ms  ▇ 1%
57 [1951]  gulp-if (node_modu...gulp-if/index.js)  702ms  ▇ 1%
58 [4677]  ./minifier (node_m...lify/minifier.js)  693ms  ▇ 1%
59 [2982]  jshint/src/cli (no...shint/src/cli.js)  671ms  ▇ 1%
60  [835]  ./manager (node_mo...t/lib/manager.js)  660ms  ▇ 1%
61 [4762]  ./package_collecti...ge_collection.js)  655ms  ▇ 1%
62 [1046]  ./lib/public/reloa...public/reload.js)  649ms  ▇ 1%
63 [3774]  ./lib/clean (node_...css/lib/clean.js)  642ms  ▇ 1%
64 [1045]  ./stream (node_mod...public/stream.js)  634ms  ▇ 1%
65 [1043]  anymatch (node_mod...nymatch/index.js)  627ms  ▇ 1%
66  [692]  engine.io (node_mo...lib/engine.io.js)  611ms  ▇ 1%
67 [1949]  ternary-stream (no...-stream/index.js)  596ms  ▇ 1%
68 [4927]  mout/lang (node_mo...les/mout/lang.js)  596ms  ▇ 1%
69  [687]  ./server (node_mod...io/lib/server.js)  583ms  ▇ 1%
70 [4600]  uglify-js (node_mo...js/tools/node.js)  579ms  ▇ 1%
71 [1041]  micromatch (node_m...romatch/index.js)  578ms  ▇ 1%
72 [4760]  ./package (node_mo...s/lib/package.js)  576ms  ▇ 1%
Total require(): 5475
Total time: 56.3s

Build with only terminal opened

Start time: (2015-07-23 10:02:09 UTC) [treshold=1%,sorted]
# [order]  module                                   time  %
 1 [4853]  /path/Work....js (gulpfile.js)  52.5s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 77%
 2 [2675]  gulp-imagemin (nod...magemin/index.js)   9.1s  ▇▇▇▇▇▇ 13%
 3  [983]  browser-sync (node...er-sync/index.js)   6.7s  ▇▇▇▇ 10%
 4  [977]  ./lib/browser-sync.../browser-sync.js)   6.7s  ▇▇▇▇ 10%
 5 [2673]  imagemin (node_mod...magemin/index.js)   6.4s  ▇▇▇▇ 9%
 6 [3582]  gulp-less (node_mo...lp-less/index.js)     5s  ▇▇▇ 7%
 7  [461]  gulp-autoprefixer...refixer/index.js)    3.9s  ▇▇▇ 6%
 8 [1864]  gulp (node_modules/gulp/index.js)        3.5s  ▇▇ 5%
 9  [880]  ./sockets (node_mo...c/lib/sockets.js)   3.1s  ▇▇ 4%
10  [878]  socket.io (node_mo...cket.io/index.js)     3s  ▇▇ 4%
11  [877]  ./lib (node_module....io/lib/index.js)     3s  ▇▇ 4%
12 [3009]  gulp-jshint (node_...int/src/index.js)   2.9s  ▇▇ 4%
13 [1214]  gulp-changed (node...changed/index.js)   2.5s  ▇▇ 4%
14 [2470]  vinyl-fs (node_mod...inyl-fs/index.js)   2.5s  ▇▇ 4%
15 [3941]  gulp-minify-css (n...ify-css/index.js)   2.4s  ▇▇ 3%
16 [1190]  gulp-util (node_mo...lp-util/index.js)   2.3s  ▇▇ 3%
17 [2083]  gulp-util (node_mo...lp-util/index.js)   2.2s  ▇▇ 3%
18 [5212]  wiredep (node_modu...redep/wiredep.js)   2.2s  ▇▇ 3%
19 [1410]  gulp-concat (node_...-concat/index.js)   2.2s  ▇▇ 3%
20 [1566]  gulp-flatten (node...flatten/index.js)     2s  ▇▇ 3%
21 [4291]  gulp-rev (node_mod...ulp-rev/index.js)     2s  ▇▇ 3%
22  [139]  gulp-util (node_mo...lp-util/index.js)   1.9s  ▇▇ 3%
23 [3205]  gulp-util (node_mo...lp-util/index.js)   1.9s  ▇▇ 3%
24 [2419]  ./lib/src (node_mo...lib/src/index.js)   1.9s  ▇▇ 3%
25 [4678]  gulp-uglify (node_...-uglify/index.js)   1.8s  ▇▇ 3%
26 [1863]  vinyl-fs (node_mod...inyl-fs/index.js)   1.8s  ▇ 3%
27 [1565]  gulp-util (node_mo...lp-util/index.js)   1.8s  ▇ 3%
28 [2836]  ./reporters (node_...porters/index.js)   1.7s  ▇ 2%
29 [5154]  bower-config (node...ig/lib/Config.js)   1.6s  ▇ 2%
30 [4504]  gulp-sass (node_mo...lp-sass/index.js)   1.6s  ▇ 2%
31 [1369]  gulp-util (node_mo...lp-util/index.js)   1.6s  ▇ 2%
32 [4230]  gulp-util (node_mo...lp-util/index.js)   1.4s  ▇ 2%
33 [1707]  gulp-util (node_mo...lp-util/index.js)   1.4s  ▇ 2%
34 [3907]  gulp-util (node_mo...lp-util/index.js)   1.4s  ▇ 2%
35  [459]  autoprefixer-core.../autoprefixer.js)    1.4s  ▇ 2%
36 [4097]  gulp-plumber (node...plumber/index.js)   1.4s  ▇ 2%
37 [3581]  less (node_modules...es/less/index.js)   1.4s  ▇ 2%
38  [840]  socket.io-client (...-client/index.js)   1.3s  ▇ 2%
39 [2806]  gulp-util (node_mo...lp-util/index.js)   1.3s  ▇ 2%
40 [3580]  ./lib/less-node (n...ss-node/index.js)   1.3s  ▇ 2%
41  [839]  ./lib/ (node_modul...ent/lib/index.js)   1.3s  ▇ 2%
42  [560]  ./async-tasks (nod...b/async-tasks.js)   1.3s  ▇ 2%
43  [559]  ./async (node_modu...ync/lib/async.js)   1.3s  ▇ 2%
44  [557]  ./utils (node_modu...ync/lib/utils.js)   1.3s  ▇ 2%
45 [3000]  ./extract (node_mo...t/src/extract.js)   1.2s  ▇ 2%
46  [692]  engine.io (node_mo...lib/engine.io.js)   1.2s  ▇ 2%
47 [1817]  ./lib/src (node_mo...lib/src/index.js)   1.2s  ▇ 2%
48 [4600]  uglify-js (node_mo...js/tools/node.js)   1.2s  ▇ 2%
49 [4096]  gulp-util (node_mo...lp-util/index.js)   1.2s  ▇ 2%
50 [4431]  gulp-util (node_mo...lp-util/index.js)   1.2s  ▇ 2%
51 [1046]  ./lib/public/reloa...public/reload.js)   1.2s  ▇ 2%
52 [1045]  ./stream (node_mod...public/stream.js)   1.2s  ▇ 2%
53 [1043]  anymatch (node_mod...nymatch/index.js)   1.2s  ▇ 2%
54  [687]  ./server (node_mod...io/lib/server.js)   1.1s  ▇ 2%
55 [4852]  del (node_modules/del/index.js)          1.1s  ▇ 2%
56 [2331]  glob-stream (node_...-stream/index.js)   1.1s  ▇ 2%
57 [1041]  micromatch (node_m...romatch/index.js)   1.1s  ▇ 2%
58 [1951]  gulp-if (node_modu...gulp-if/index.js)   1.1s  ▇ 2%
59 [4766]  asset-builder (nod...builder/index.js)     1s  ▇ 2%
60 [4765]  ./lib/Manifest.js.../lib/Manifest.js)      1s  ▇ 2%
61 [2982]  jshint/src/cli (no...shint/src/cli.js)     1s  ▇ 1%
62 [4599]  source-map (node_m...ib/source-map.js)  965ms  ▇ 1%
63  [976]  browser-sync-ui (n...sync-ui/index.js)  936ms  ▇ 1%
64  [835]  ./manager (node_mo...t/lib/manager.js)  931ms  ▇ 1%
65  [971]  ./lib/UI (node_mod...ync-ui/lib/UI.js)  913ms  ▇ 1%
66 [1143]  ./lib/noop (node_m...util/lib/noop.js)  835ms  ▇ 1%
67 [1142]  through2 (node_mod...ugh2/through2.js)  833ms  ▇ 1%
68 [3315]  /pathWork...adapters/less.js)  810ms  ▇ 1%
69 [2036]  ./lib/noop (node_m...util/lib/noop.js)  810ms  ▇ 1%
70 [1949]  ternary-stream (no...-stream/index.js)  805ms  ▇ 1%
71 [2672]  imagemin-svgo (nod...in-svgo/index.js)  799ms  ▇ 1%
72 [3123]  ./lib/template (no.../lib/template.js)  799ms  ▇ 1%
73 [4764]  main-bower-files (...r-files/index.js)  790ms  ▇ 1%
74 [2035]  through2 (node_mod...ugh2/through2.js)  789ms  ▇ 1%
75 [4763]  ./lib (node_module...les/lib/index.js)  774ms  ▇ 1%
76 [2162]  buffer-to-vinyl (n...o-vinyl/index.js)  769ms  ▇ 1%
77 [3119]  lodash.template (n...emplate/index.js)  768ms  ▇ 1%
78  [817]  engine.io-client (...-client/index.js)  766ms  ▇ 1%
79  [816]  ./lib/ (node_modul...ent/lib/index.js)  739ms  ▇ 1%
80 [1139]  readable-stream/tr...eam/transform.js)  718ms  ▇ 1%
81 [2670]  svgo (node_modules...svgo/lib/svgo.js)  714ms  ▇ 1%
82 [3309]  ../adapter_base (n.../adapter_base.js)  711ms  ▇ 1%
83  [814]  ./socket (node_mod...nt/lib/socket.js)  703ms  ▇ 1%
84 [1138]  ./lib/_stream_tran...eam_transform.js)  690ms  ▇ 1%
85 [2580]  imagemin-optipng (...optipng/index.js)  686ms  ▇ 1%
Total require(): 5475
Total time: 1m 8.5s

And any chance of taking a look at your memory tab in activity monitor, such as:

Yes, I was doing that. Both screenshot are relative to the build with no apps opened.

RAM Screenshot: at the start

RAM Screenshot: at the end

Well… I’m out of ideas for now!

I opened an issue on gulp github: https://github.com/gulpjs/gulp/issues/1163
but I hope to get help here!

No ideas?

On github a funny guy said me:

Your requires are extremely slow. I would check your ssd drive to make sure it isn’t failing.

But my ssd obviously works great, it gives me no problems except for gulp…

Have you gone through everything in this thread?

Have you tried with only one Sage project? What happens if you clone a fresh Sage theme and run it?

I was wondering if anyone else was having this issue with gulp being slow rebuild changes. I searched around and found this:

https://github.com/gulpjs/gulp/issues/448

You want to change the synced NFS to mount with this option.

config.vm.synced_folder local_site_path(site), nfs_path(name), :nfs => true, :mount_options => ['actimeo=2']

I did this about 10 minutes ago because I was going crazy with the slow build, first time I made a change it started building almost immediately. I just completely powered off my VM (not just suspend), made the change in the Vagrantfile and brought it back up.

Also just ran across this post - [https://www.jverdeyen.be/vagrant/speedup-vagrant-nfs/][1]

Seems like there may be some other good ideas in here to speed up NFS as well.