Skip to content

Commit

Permalink
change: raise minimal worker parallelism suggestion for threaded worl…
Browse files Browse the repository at this point in the history
…d-gen to 4

Also prints a warning when that is being done
  • Loading branch information
ishland committed Jun 6, 2023
1 parent a90e1a6 commit 92aca41
Showing 1 changed file with 13 additions and 4 deletions.
@@ -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");
}
}

}

0 comments on commit 92aca41

Please sign in to comment.