mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Update perf test contenders, add node-images
This commit is contained in:
parent
e398b471e1
commit
b7b6fdbdf5
@ -5,7 +5,7 @@
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"description": "Benchmark and performance tests for sharp",
|
||||
"scripts": {
|
||||
"test": "VIPS_WARNING=0 node perf && node random && node parallel"
|
||||
"test": "node perf && node random && node parallel"
|
||||
},
|
||||
"devDependencies": {
|
||||
"async": "^2.1.4",
|
||||
@ -13,9 +13,10 @@
|
||||
"gm": "^1.23.0",
|
||||
"imagemagick": "^0.1.3",
|
||||
"imagemagick-native": "^1.9.3",
|
||||
"images": "^3.0.0",
|
||||
"jimp": "^0.2.27",
|
||||
"lwip": "^0.0.9",
|
||||
"mapnik": "^3.5.14",
|
||||
"mapnik": "^3.6.0",
|
||||
"pajk-lwip": "^0.2.0",
|
||||
"semver": "^5.3.0"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
|
@ -7,11 +7,12 @@ const assert = require('assert');
|
||||
const Benchmark = require('benchmark');
|
||||
|
||||
// Contenders
|
||||
const sharp = require('../../');
|
||||
const gm = require('gm');
|
||||
const imagemagick = require('imagemagick');
|
||||
const mapnik = require('mapnik');
|
||||
const jimp = require('jimp');
|
||||
const sharp = require('../../');
|
||||
const images = require('images');
|
||||
let imagemagickNative;
|
||||
try {
|
||||
imagemagickNative = require('imagemagick-native');
|
||||
@ -20,7 +21,7 @@ try {
|
||||
}
|
||||
let lwip;
|
||||
try {
|
||||
lwip = require('lwip');
|
||||
lwip = require('pajk-lwip');
|
||||
} catch (err) {
|
||||
console.log('Excluding lwip');
|
||||
}
|
||||
@ -145,7 +146,7 @@ async.series({
|
||||
}).add('mapnik-buffer-buffer', {
|
||||
defer: true,
|
||||
fn: function (deferred) {
|
||||
mapnik.Image.fromBytes(inputJpgBuffer, function (err, img) {
|
||||
mapnik.Image.fromBytes(inputJpgBuffer, { max_size: 3000 }, function (err, img) {
|
||||
if (err) throw err;
|
||||
img
|
||||
.resize(width, height, {
|
||||
@ -266,6 +267,12 @@ async.series({
|
||||
});
|
||||
}
|
||||
});
|
||||
// images
|
||||
jpegSuite.add('images-file-file', function () {
|
||||
images(fixtures.inputJpg)
|
||||
.resize(width, height)
|
||||
.save(fixtures.outputJpg, { quality: 80 });
|
||||
});
|
||||
// sharp
|
||||
jpegSuite.add('sharp-buffer-file', {
|
||||
defer: true,
|
||||
@ -733,7 +740,7 @@ async.series({
|
||||
}).add('mapnik-buffer-buffer', {
|
||||
defer: true,
|
||||
fn: function (deferred) {
|
||||
mapnik.Image.fromBytes(inputPngBuffer, function (err, img) {
|
||||
mapnik.Image.fromBytes(inputPngBuffer, { max_size: 3000 }, function (err, img) {
|
||||
if (err) throw err;
|
||||
img.premultiply(function (err, img) {
|
||||
if (err) throw err;
|
||||
@ -819,6 +826,12 @@ async.series({
|
||||
});
|
||||
}
|
||||
});
|
||||
// images
|
||||
pngSuite.add('images-file-file', function () {
|
||||
images(fixtures.inputPng)
|
||||
.resize(width, height)
|
||||
.save(fixtures.outputPng);
|
||||
});
|
||||
// sharp
|
||||
pngSuite.add('sharp-buffer-file', {
|
||||
defer: true,
|
||||
@ -957,7 +970,7 @@ async.series({
|
||||
}).add('sharp-file-buffer', {
|
||||
defer: true,
|
||||
fn: function (deferred) {
|
||||
sharp(fixtures.inputWebp)
|
||||
sharp(fixtures.inputWebP)
|
||||
.resize(width, height)
|
||||
.toBuffer(function (err, buffer) {
|
||||
if (err) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user