From fbb175608dc13f1295af169ccb46e2f476d36d19 Mon Sep 17 00:00:00 2001 From: Jonas Hermsmeier Date: Fri, 19 Jan 2018 16:11:09 +0100 Subject: [PATCH] feat(writer): Increase UV_THREADPOOL_SIZE This increases the UV_THREADPOOL_SIZE to CPUs * 4 to facilitate full write speeds when writing to multiple destinations, in preparation for integrating multi-writes. Change-Type: patch Changelog-Entry: Increase UV_THREADPOOL_SIZE to allocate 4 threads per CPU --- lib/gui/app/modules/image-writer.js | 8 ++++++++ 1 file changed, 8 insertions(+) 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')),