From: Pierre Ossman Date: Fri, 20 Nov 2015 15:14:48 +0000 (+0100) Subject: Limit the number of decoder threads to 4 X-Git-Tag: v1.6.90~95^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a0eb1e8af915201a260bac19d33fee76faf665ca;p=tigervnc.git Limit the number of decoder threads to 4 They just end up burning CPU fighting each other without much improvement to the decoding time beyond four threads. --- diff --git a/common/rfb/DecodeManager.cxx b/common/rfb/DecodeManager.cxx index d6c3b0b5..d7cffcfd 100644 --- a/common/rfb/DecodeManager.cxx +++ b/common/rfb/DecodeManager.cxx @@ -51,7 +51,12 @@ DecodeManager::DecodeManager(CConnection *conn) : vlog.error("Unable to determine the number of CPU cores on this system"); cpuCount = 1; } else { - vlog.info("Detected %d CPU core(s) available for decoding", (int)cpuCount); + vlog.info("Detected %d CPU core(s)", (int)cpuCount); + // No point creating more threads than this, they'll just end up + // wasting CPU fighting for locks + if (cpuCount > 4) + cpuCount = 4; + vlog.info("Creating %d decoder thread(s)", (int)cpuCount); } while (cpuCount--) {