Repository navigation
The new syntax for running tasks is slower? #225
Description
Activity
Can you post your gulpfile.js before and after please?
I've managed to isolate the part of the gulp file that affects compilation times.
It's actually the
returnbefore gulp.src in my sass task. I've added thatreturnas I've saw it mentioned in a few recipes. Since the compilation works faster without it im removing it.Im also closing the ticket as this is most likely a configuration problem. If that isn't the case, please let me know.
// Include gulp var gulp = require('gulp'), lr = require('tiny-lr'), sass = require('gulp-sass'), prefix = require('gulp-autoprefixer'), plumber = require('gulp-plumber'), livereload = require('gulp-livereload'), server = lr(), notify = require("gulp-notify"); var options = { SASS_SOURCE : "sass/**/*.scss", CSS_DEST : "../assets/css/", // JavaScript JS_SOURCE : "src/scripts/**/*.js", JS_DEST : "dist/assets/js", JS_CONCAT_TARGET : "main.js", // Images IMAGE_SRC : "src/images/**/*", IMAGE_DEST : "dist/assets/img", // Live reload LIVE_RELOAD_PORT : 35729 }; // Compile Our Sass gulp.task('sass', function() { return gulp.src( options.SASS_SOURCE ) .pipe(plumber()) .pipe(sass({ //includePaths: ['./sass'], outputStyle: 'expanded' })) .on("error", notify.onError()) .on("error", function (err) { console.log("Error:", err); }) .pipe(prefix( "last 1 version", "> 10%" )) .pipe(gulp.dest(options.CSS_DEST)) .pipe(livereload(server)); }); gulp.task('default', function () { gulp.watch( options.SASS_SOURCE , ['sass']); }); gulp.task('lr', function () { server.listen( options.LIVE_RELOAD_PORT , function (err) { if (err) return console.log(err); // Watch .SCSS files gulp.watch( options.SASS_SOURCE , function (event) { console.log('File ' + event.path + ' was ' + event.type + ', running tasks...'); gulp.run('sass'); }); }); });By not returning it the task system doesn't wait for the stream to finish before ending the task. It has always taken 269ms and removing return is just going to change your logs to say otherwise
Thanks @contra , if im understanding correctly it has no effect performance wise, is just the way it communicates times then.
I think gulp gave me a speed addiction problem :-)
@lmartins Also the way task dependencies work. If you don't return the stream from a and b has a dependency on it then they will both end up running at the same time.
For some reason, after changing my gulp file to the new format (removing gulp.run) the compilation time for gulp-sass became noticeable slower.
What usually took:
Not takes:
It's not a huge difference I know, but still, worth nothing I guess.