Speedtesting gulp.js and Grunt
Using the Kickoff framework, I compare two of the most popular client-side task runners
gulp.js (external site) is the new hot young thing on the front-end circuit; it is a task runner similar to Grunt (external site). There are many anecdotal reports saying that gulp.js is far quicker than Grunt at performing similar tasks so naturally I wanted to see this for myself using Kickoff (external site) – the front-end framework we use at TMW – as a Guinea Pig.
Kickoff uses Grunt for a number of tasks; compiling Sass and updating the browser view on-the-fly and concatenating and minifying Javascript for example. Porting this config from Grunt to gulp.js was fairly easy. Travis Maynard has written a great intro to gulp.js (external site) which made this switch doubly easy.
The gulp.js fork of Kickoff can be found at github.com/tmwagency/kickoff/tree/gulp (external site) and the gulpfile.js (external site) holds all the config. I found editing the gulpfile quite easy; more so than a Gruntfile. I followed similar ideas to our Grunt setup to make it more maintainable e.g. using variables to avoid repetition – see lines 16-37 (external site) of the Kickoff gulpfile.
Speed comparison tests
Sass compilation

Gulp here is about twice as fast as Grunt at running the same task and immediately you can see what all the fuss is about. Grunt uses grunt-contrib-sass (external site) and gulp.js uses gulp-ruby-sass (external site) (both of which use Ruby) to compile. gulp-ruby-sass is slower than gulp-sass (external site), but more stable and feature-rich so I will make the switch when it improves, so I reckon that the difference will be even greater when this happens. See the gulpfile settings for this here (external site).
Javascript minification and concatination using Uglify.js

The difference here is not that large but it is still impressive. See the gulpfile settings for this here (external site).
Live Reload
Live Reload is an indispensable tool for us, both gulp.js and Grunt have plugins for it (Grunt’s is built into grunt-contrib-watch (external site)). I was not able to measure the speeds between the two but I would say that gulp.js was noticeably quicker overall, but not hugely.
Conclusion
As you can see gulp.js is insanely fast, but that does not mean we are going to be making the switch any time soon. There are two plugins that we regularly use that aren’t supported by gulp.js, these are grunt-contrib-connect (external site) (for starting a static web server) and grunt-jekyll (external site) (for building our Jekyll sites). gulp.js just doesn’t have the ecosystem and support that Grunt has; although the one man army of Sindre Sorhus (external site) might be changing that!
Update 16/01/2014
It has come to my attention that people are misinterpreting this post slightly. My purpose was not to provide a scientific comparison of the two but more of a real world, anecdotal comparison, as Luis Martins (external site) states below, there seem to be significant speed gains using gulp.js.
It also seems that there was a misunderstanding, on my part, of what gulp.js is compared to Grunt. I did not realise initially that one could write the code (external site) (thanks mollerse (external site)) for a static server within the gulpfile, negating the need for a specific plugin. The same could also be said of a specific Jekyll plugin.
In any case, it seems to have got the discussion started about this misconception which can only be a good thing.
Update 17/01/2014
Eric Schoffstall (external site), creator of gulp.js, actually submitted a pull request (external site) on my gulpfile to help improve the accuracy of these timings. As a result, the speed gains are not as significant as I once thought but they are still pretty large. I have updated the screenshots and copy above to reflect these new timings.
Find out more
- gulp.js home page (external site)
- gulp.js plugins directory (external site)
- gulp.js Github repo (external site)
- Introduction to Gulp (external site) by it’s creator, Eric Schoffstall (external site)
- Getting started with Gulp (external site) by Travis Maynard - great intro to gulp.js
- Gulp, Grunt, Whatever (external site) by Nicolas Bevacqua - another good intro