Skip to content

Instantly share code, notes, and snippets.

@anru
Created December 15, 2014 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anru/45339f17b7221c9c1684 to your computer and use it in GitHub Desktop.
Save anru/45339f17b7221c9c1684 to your computer and use it in GitHub Desktop.
stress testing for rsvg
var gulp = require('gulp');
var rsvg = require('gulp-rsvg');
var through = require('through2');
var pot = gulp.pot;
var N = 110;
var C = 2;
gulp.task('st', function(cb) {
var i = N;
function doJob(c, cb) {
var streams = [];
while (c--) {
var s = gulp.src('private/svg/*.svg')
.pipe(rsvg())
.pipe(through.obj(function(file, enc, cb) {
if (file.contents.length == 0 || file.stat.size == 0) {
console.error('Zero svg detected!', file.path)
}
cb(null, file);
}));
streams.push(s);
}
pot.eswait(streams, cb);
}
function runNext() {
console.log('iteration', i);
doJob(C, function() {
if (i--) {
runNext();
} else {
cb();
}
})
}
runNext();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment