diff --git a/lib/gui/app/modules/image-writer.js b/lib/gui/app/modules/image-writer.js index 2995e320..b7cfb1e5 100644 --- a/lib/gui/app/modules/image-writer.js +++ b/lib/gui/app/modules/image-writer.js @@ -31,6 +31,13 @@ const windowProgress = require('../os/window-progress') const analytics = require('../modules/analytics') const packageJSON = require('../../../../package.json') +/** + * @summary Number of threads per CPU to allocate to the UV_THREADPOOL + * @type {Number} + * @constant + */ +const THREADS_PER_CPU = 4 + /** * @summary Get application entry point * @function @@ -165,6 +172,7 @@ exports.performWrite = (image, drive, onProgress) => { IPC_CLIENT_ID, IPC_SOCKET_ROOT: ipc.config.socketRoot, ELECTRON_RUN_AS_NODE: 1, + UV_THREADPOOL_SIZE: os.cpus().length * THREADS_PER_CPU, // Casting to Number nicely converts booleans to 0 or 1. OPTION_VALIDATE: Number(settings.get('validateWriteOnSuccess')),