Skip to content

Commit

Permalink
Tests: skip mapnik and tensorflow for Docker-run benchmarks
Browse files Browse the repository at this point in the history
Maintainance of mapnik seems to have stalled, no ARM64 support
Memory requirements of Tensorflow too high, hangs/crashes on AMD64
  • Loading branch information
lovell committed Dec 20, 2022
1 parent 15f5cd4 commit 78dada9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/bench/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ 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
RUN cd /tmp && git clone --single-branch --branch $BRANCH https://github.com/lovell/sharp.git
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
Expand Down
2 changes: 1 addition & 1 deletion test/bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -19,6 +18,7 @@
"semver": "7.3.8"
},
"optionalDependencies": {
"@tensorflow/tfjs-node": "4.1.0",
"mapnik": "4.5.9"
},
"license": "Apache-2.0",
Expand Down
17 changes: 12 additions & 5 deletions test/bench/perf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 78dada9

Please sign in to comment.