Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change: raise minimal worker parallelism suggestion for threaded worl…
…d-gen to 4 Also prints a warning when that is being done
- Loading branch information
Showing
1 changed file
with
13 additions
and
4 deletions.
There are no files selected for viewing
17 changes: 13 additions & 4 deletions
17
...hreading-worldgen/src/main/java/com/ishland/c2me/threading/worldgen/ModuleEntryPoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
package com.ishland.c2me.threading.worldgen; | ||
|
||
import com.ishland.c2me.base.common.GlobalExecutors; | ||
import com.ishland.c2me.base.common.config.ConfigSystem; | ||
import com.ishland.c2me.threading.worldgen.common.Config; | ||
|
||
import static com.ishland.c2me.base.ModuleEntryPoint.defaultParallelism; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
class ModuleEntryPoint { | ||
|
||
public static final Logger LOGGER = LoggerFactory.getLogger("C2ME Threaded WorldGen"); | ||
|
||
public static final boolean enabled = new ConfigSystem.ConfigAccessor() | ||
.key("threadedWorldGen.enabled") | ||
.comment("Whether to enable this feature") | ||
.getBoolean(defaultParallelism >= 3, false); | ||
.comment(""" | ||
Whether to enable this feature\s | ||
This feature may cause regression when worker parallelism is lower than 4. | ||
""") | ||
.getBoolean(GlobalExecutors.GLOBAL_EXECUTOR_PARALLELISM >= 4, false); | ||
|
||
static { | ||
Config.init(); | ||
if (enabled && GlobalExecutors.GLOBAL_EXECUTOR_PARALLELISM < 4) { | ||
LOGGER.warn("WARNING: Global worker parallelism is lower than 4 and threaded worldgen is enabled. This may cause regression in worldgen performance"); | ||
} | ||
} | ||
|
||
} |