gulp-webp icon indicating copy to clipboard operation
gulp-webp copied to clipboard

Too slow?

Open notiv-nt opened this issue 6 years ago • 4 comments

gulpconfig

const gulp = require('gulp');
const webp = require('gulp-webp');

gulp.task('img', () => {
  return gulp
    .src('src/*')
    .pipe(webp())
    .pipe(gulp.dest('dist'));
});

package.json

{
  "dependencies": {
    "gulp": "^4.0.2",
    "gulp-webp": "^4.0.1"
  }
}

src 12.9mb

image

dest 6.7mb (52%)

image

console

image

15 seconds? Why so slow?

In realtime:

1

notiv-nt avatar May 09 '19 17:05 notiv-nt

Heh? The same but with native imagemin:

2

notiv-nt avatar May 09 '19 17:05 notiv-nt

One more thing:

const gulp = require('gulp');
const webp = require('gulp-webp');
const imagemin = require('gulp-imagemin');
const imageminWebp = require('imagemin-webp');
const rename = require('gulp-rename');

gulp.task('img', () => {
  return gulp
    .src('src/*')
    .pipe(webp())
    .pipe(gulp.dest('dist'));
});

gulp.task('img-min', () => {
  return gulp
    .src('src/*')
    .pipe(imagemin([imageminWebp()]))
    .pipe(rename({ extname: '.webp' }))
    .pipe(gulp.dest('dist'));
});


  1. npx gulp img 12s
  2. npx gulp img-min 2.7s

notiv-nt avatar May 09 '19 18:05 notiv-nt

Thanks for this @notiv-nt +1 indeed

jamesryan-dev avatar Dec 01 '20 08:12 jamesryan-dev

Excellent contribution @notiv-nt it made a drastic difference in my optimization times:

Before image

Now image

mihail-minkov avatar Jan 25 '22 21:01 mihail-minkov