From a57d7b51b1152c576ce260f10ff3f7c653e740ad Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Sun, 14 Mar 2021 19:51:45 +0000 Subject: [PATCH] Tests: match concurrency with CPU count --- test/bench/perf.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/bench/perf.js b/test/bench/perf.js index 9e665179..27fff04f 100644 --- a/test/bench/perf.js +++ b/test/bench/perf.js @@ -1,5 +1,6 @@ 'use strict'; +const os = require('os'); const fs = require('fs'); const async = require('async'); @@ -25,6 +26,9 @@ const height = 588; // Disable libvips cache to ensure tests are as fair as they can be sharp.cache(false); +// Spawn one thread per CPU +sharp.concurrency(os.cpus().length); + async.series({ jpeg: function (callback) { const inputJpgBuffer = fs.readFileSync(fixtures.inputJpg);