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

@@ -13,7 +13,7 @@
"gm": "^1.21.0",
"imagemagick": "^0.1.3",
"imagemagick-native": "elad/node-imagemagick-native",
"jimp": "^0.2.19",
"jimp": "^0.2.20",
"lwip": "^0.0.8",
"semver": "^5.1.0"
},

View File

@@ -12,6 +12,7 @@ var width = 720;
var height = 480;
sharp.concurrency(1);
sharp.simd(true);
var timer = setInterval(function() {
console.dir(sharp.counters());

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) {

View File

@@ -8,6 +8,8 @@ var Benchmark = require('benchmark');
var sharp = require('../../index');
var fixtures = require('../fixtures');
sharp.simd(true);
var min = 320;
var max = 960;