Allow SIMD vector unit to be toggled on/off #172

Currently defaults to off but future versions may default to on
This commit is contained in:
Lovell Fuller
2015-12-12 09:11:50 +00:00
parent 95cf35efc5
commit 32c4b9eff1
12 changed files with 107 additions and 10 deletions

View File

@@ -35,6 +35,8 @@ var magickFilterBicubic = 'Lanczos';
// Disable libvips cache to ensure tests are as fair as they can be
sharp.cache(0);
// Enable use of SIMD
sharp.simd(true);
async.series({
'jpeg-linear': function(callback) {
@@ -496,6 +498,24 @@ async.series({
}
});
}
}).add('sharp-without-simd', {
defer: true,
fn: function(deferred) {
sharp.simd(false);
sharp(inputJpgBuffer)
.rotate(90)
.interpolateWith(sharp.interpolator.bilinear)
.resize(width, height)
.toBuffer(function(err, buffer) {
sharp.simd(true);
if (err) {
throw err;
} else {
assert.notStrictEqual(null, buffer);
deferred.resolve();
}
});
}
}).add('sharp-sequentialRead', {
defer: true,
fn: function(deferred) {