mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Test: update bench deps, use physical CPU core count
This commit is contained in:
parent
aabbe1fa08
commit
70a3067963
@ -17,11 +17,8 @@
|
||||
"jimp": "0.22.10"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@tensorflow/tfjs-node": "4.9.0",
|
||||
"@tensorflow/tfjs-node": "4.11.0",
|
||||
"mapnik": "4.5.9"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": "16"
|
||||
}
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
const { exec } = require('child_process');
|
||||
const { exec, execSync } = require('child_process');
|
||||
|
||||
const async = require('async');
|
||||
const Benchmark = require('benchmark');
|
||||
@ -40,8 +40,10 @@ const heightPng = 540;
|
||||
// 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);
|
||||
// Spawn one thread per physical CPU core
|
||||
const physicalCores = Number(execSync('lscpu -p | egrep -v "^#" | sort -u -t, -k 2,4 | wc -l', { encoding: 'utf-8' }).trim());
|
||||
console.log(`Detected ${physicalCores} physical cores`);
|
||||
sharp.concurrency(physicalCores);
|
||||
|
||||
async.series({
|
||||
jpeg: function (callback) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user