-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: make number of chunk processing threads configurable #5237
Conversation
chunkThreads.setRange(Runtime.getRuntime().availableProcessors()); | ||
chunkThreads.setLabelFunction(input -> { | ||
if (input == 0) { | ||
return "Auto"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this string be translated? I am not sure about how dynamic values are handled at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, that seems very international.
@@ -51,7 +51,7 @@ class ChunkProcessingPipelineTest extends TerasologyTestingEnvironment { | |||
|
|||
@Test | |||
void simpleProcessingSuccess() throws ExecutionException, InterruptedException, TimeoutException { | |||
pipeline = new ChunkProcessingPipeline((p) -> null, (o1, o2) -> 0); | |||
pipeline = new ChunkProcessingPipeline(0, (p) -> null, (o1, o2) -> 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A value of 0
to represent "Automatic" does seem a bit unexpected in hindsight, Do you think another value would make sense? Or maybe wrapping it in a constant would be enough?
7b7fc6d
to
5e6b3c1
Compare
Contains
This pull request adds a setting to control the maximum number of available worker threads for chunk processing. More precisely, it controls the number of pooled threads available to
ChunkProcessingPipeline
.From testing, I have found that reducing the number of chunk threads can noticeably reduce overall CPU utilisation. Although modern operating systems are very good at multitasking, I have noticed detrimental system-wide effects when the game occupies too much processor time at once. The ideal quantity will vary from player to player and so I think this may be a useful option to have configurable.
How to test
Video Settings
screen viaSettings->Video
.Chunk Threads
setting on the left.Auto
.Settings->Video
screen.