Created
December 15, 2014 05:08
-
-
Save anru/45339f17b7221c9c1684 to your computer and use it in GitHub Desktop.
stress testing for rsvg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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