rename fields top match config key
This commit is contained in:
parent
8a25f8a511
commit
322a77da9e
@ -78,7 +78,7 @@ public class TerraContext extends GeneratorContext {
|
|||||||
CommentedConfig config = PerfDefaults.getAndPrintPerfSettings();
|
CommentedConfig config = PerfDefaults.getAndPrintPerfSettings();
|
||||||
boolean batching = config.getOrElse("batching",false);
|
boolean batching = config.getOrElse("batching",false);
|
||||||
int tileSize = Math.min(PerfDefaults.MAX_TILE_SIZE, Math.max(2, config.getInt("tile_size")));
|
int tileSize = Math.min(PerfDefaults.MAX_TILE_SIZE, Math.max(2, config.getInt("tile_size")));
|
||||||
int batchCount = Math.min(PerfDefaults.MAX_BATCH_SIZE, Math.max(1, config.getInt("batch_count")));
|
int batchCount = Math.min(PerfDefaults.MAX_BATCH_COUNT, Math.max(1, config.getInt("batch_count")));
|
||||||
int threadCount = Math.min(PerfDefaults.MAX_THREAD_COUNT, Math.max(1, config.getInt("thread_count")));
|
int threadCount = Math.min(PerfDefaults.MAX_THREAD_COUNT, Math.max(1, config.getInt("thread_count")));
|
||||||
return RegionGenerator.builder()
|
return RegionGenerator.builder()
|
||||||
.pool(ThreadPools.create(threadCount, batching))
|
.pool(ThreadPools.create(threadCount, batching))
|
||||||
|
@ -57,7 +57,7 @@ public class ConfigManager {
|
|||||||
set(
|
set(
|
||||||
cfg,
|
cfg,
|
||||||
"batch_count",
|
"batch_count",
|
||||||
PerfDefaults.BATCH_SIZE,
|
PerfDefaults.BATCH_COUNT,
|
||||||
"Controls the number of pieces a heightmap tile is divided up into.",
|
"Controls the number of pieces a heightmap tile is divided up into.",
|
||||||
"Higher batch counts may be able to utilize more of the available threads, improving performance."
|
"Higher batch counts may be able to utilize more of the available threads, improving performance."
|
||||||
);
|
);
|
||||||
|
@ -7,18 +7,18 @@ import com.terraforged.core.concurrent.thread.ThreadPools;
|
|||||||
public class PerfDefaults {
|
public class PerfDefaults {
|
||||||
|
|
||||||
public static final int TILE_SIZE = 3;
|
public static final int TILE_SIZE = 3;
|
||||||
public static final int BATCH_SIZE = 6;
|
public static final int BATCH_COUNT = 6;
|
||||||
public static final int THREAD_COUNT = ThreadPools.defaultPoolSize();
|
public static final int THREAD_COUNT = ThreadPools.defaultPoolSize();
|
||||||
|
|
||||||
public static final int MAX_TILE_SIZE = 8;
|
public static final int MAX_TILE_SIZE = 8;
|
||||||
public static final int MAX_BATCH_SIZE = 20;
|
public static final int MAX_BATCH_COUNT = 20;
|
||||||
public static final int MAX_THREAD_COUNT = Runtime.getRuntime().availableProcessors();
|
public static final int MAX_THREAD_COUNT = Runtime.getRuntime().availableProcessors();
|
||||||
|
|
||||||
private static boolean isUsingDefaultPerfSettings(CommentedConfig config) {
|
private static boolean isUsingDefaultPerfSettings(CommentedConfig config) {
|
||||||
boolean yes = true;
|
boolean yes = true;
|
||||||
yes &= config.getOrElse("batching", true);
|
yes &= config.getOrElse("batching", true);
|
||||||
yes &= config.getInt("thread_count") == THREAD_COUNT;
|
yes &= config.getInt("thread_count") == THREAD_COUNT;
|
||||||
yes &= config.getInt("batch_size") == BATCH_SIZE;
|
yes &= config.getInt("batch_size") == BATCH_COUNT;
|
||||||
yes &= config.getInt("tile_size") == TILE_SIZE;
|
yes &= config.getInt("tile_size") == TILE_SIZE;
|
||||||
return yes;
|
return yes;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user