From 1777be44440057576741e1dce450cfdbe7ba38d9 Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Fri, 25 Jul 2025 07:44:20 -0400 Subject: [PATCH] [Web] Fix the editor `{godot,emscripten}PoolSize` config values Co-authored-by: Fabio Alessandrelli --- misc/dist/html/editor.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html index 9bc9474cfd2..41caac64426 100644 --- a/misc/dist/html/editor.html +++ b/misc/dist/html/editor.html @@ -674,6 +674,10 @@ function startEditor(zip) { } } + const clamp = (value, min, max) => Math.min(Math.max(value, min), max); + // We need at least 6 free threads from the pool to start the editor. + // At least 4 more will be reserved for the godot thread pool (3 is the bare minimum with the multithreaded variant of the servers). + const concurrency = clamp(navigator.hardwareConcurrency ?? 1, 12, 24); const editorConfig = { 'unloadAfterInit': false, 'onProgress': function progressFunction(current, total) { @@ -700,6 +704,8 @@ function startEditor(zip) { }, 'onExecute': Execute, 'persistentPaths': persistentPaths, + 'emscriptenPoolSize': concurrency, + 'godotPoolSize': Math.floor(concurrency / 3), // Ensures at least 4 threads for the pool (see above). }; editor = new Engine(editorConfig);