Tests: skip mapnik and tensorflow for Docker-run benchmarks

Maintainance of mapnik seems to have stalled, no ARM64 support
Memory requirements of Tensorflow too high, hangs/crashes on AMD64
This commit is contained in:
Lovell Fuller 2022-12-19 20:04:12 +00:00
parent 15f5cd4671
commit 78dada9126
3 changed files with 15 additions and 8 deletions

View File

@ -9,7 +9,7 @@ RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y nodejs
# Install benchmark dependencies
RUN apt-get install -y imagemagick libmagick++-dev graphicsmagick libmapnik-dev
RUN apt-get install -y imagemagick libmagick++-dev graphicsmagick
# Install sharp
RUN mkdir /tmp/sharp
@ -17,7 +17,7 @@ RUN cd /tmp && git clone --single-branch --branch $BRANCH https://github.com/lov
RUN cd /tmp/sharp && npm install --build-from-source
# Install benchmark test
RUN cd /tmp/sharp/test/bench && npm install
RUN cd /tmp/sharp/test/bench && npm install --omit optional
RUN cat /etc/os-release | grep VERSION=
RUN node -v

View File

@ -10,7 +10,6 @@
"dependencies": {
"@squoosh/cli": "0.7.2",
"@squoosh/lib": "0.4.0",
"@tensorflow/tfjs-node": "4.1.0",
"async": "3.2.4",
"benchmark": "2.1.4",
"gm": "1.25.0",
@ -19,6 +18,7 @@
"semver": "7.3.8"
},
"optionalDependencies": {
"@tensorflow/tfjs-node": "4.1.0",
"mapnik": "4.5.9"
},
"license": "Apache-2.0",

View File

@ -7,15 +7,22 @@ const { exec } = require('child_process');
const async = require('async');
const Benchmark = require('benchmark');
const safeRequire = (name) => {
try {
return require(name);
} catch (err) {}
return null;
};
// Contenders
const sharp = require('../../');
const gm = require('gm');
const imagemagick = require('imagemagick');
const mapnik = require('mapnik');
const mapnik = safeRequire('mapnik');
const jimp = require('jimp');
const squoosh = require('@squoosh/lib');
process.env.TF_CPP_MIN_LOG_LEVEL = 1;
const tfjs = require('@tensorflow/tfjs-node');
const tfjs = safeRequire('@tensorflow/tfjs-node');
const fixtures = require('../fixtures');
@ -138,7 +145,7 @@ async.series({
}
});
// mapnik
jpegSuite.add('mapnik-file-file', {
mapnik && jpegSuite.add('mapnik-file-file', {
defer: true,
fn: function (deferred) {
mapnik.Image.open(fixtures.inputJpg, function (err, img) {
@ -253,7 +260,7 @@ async.series({
}
});
// tfjs
jpegSuite.add('tfjs-node-buffer-buffer', {
tfjs && jpegSuite.add('tfjs-node-buffer-buffer', {
defer: true,
fn: function (deferred) {
const decoded = tfjs.node.decodeJpeg(inputJpgBuffer);
@ -677,7 +684,7 @@ async.series({
}
});
// mapnik
pngSuite.add('mapnik-file-file', {
mapnik && pngSuite.add('mapnik-file-file', {
defer: true,
fn: function (deferred) {
mapnik.Image.open(fixtures.inputPngAlphaPremultiplicationLarge, function (err, img) {