Skip to content
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

Make thread count configurable #36

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ How many scroll pixels (as reported by L.DomEvent.getWheelDelta) mean
for security reasons. But you do you, boo boo.""")
public static boolean HTTPD_FOLLOW_SYMLINKS = false;

@Key("settings.performance.live-update-threads")
@Comment("""
The number of process-threads to use for real-time marker updates on the map.
Value of -1 will use 50% of the available cpu-threads. (recommended)""")
public static int LIVE_UPDATE_THREADS = -1;

@Key("settings.performance.render-threads")
@Comment("""
The number of process-threads to use for loading and scanning chunks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public class UpdateLiveData extends AbstractDataTask {
.build();
private Map<String, CompletableFuture<Void>> liveUpdateFutures;

public UpdateLiveData(@NotNull World world) {
super(1, true, world, "Pl3xMap-LiveData", 2);
public UpdateLiveData(@NotNull World world, int threads) {
super(1, true, world, "Pl3xMap-LiveData", threads);
this.liveUpdateFutures = new HashMap<>();
}

Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/net/pl3x/map/core/world/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import javax.imageio.ImageIO;
import net.pl3x.map.core.Keyed;
import net.pl3x.map.core.Pl3xMap;
import net.pl3x.map.core.configuration.Config;
import net.pl3x.map.core.configuration.PlayersLayerConfig;
import net.pl3x.map.core.configuration.SpawnLayerConfig;
import net.pl3x.map.core.configuration.WorldBorderLayerConfig;
Expand Down Expand Up @@ -128,7 +129,7 @@ public World(@NotNull String name, long seed, @NotNull Point spawn, @NotNull Typ
this.regionModifiedState = new RegionModifiedState(this);
//this.regionFileWatcher = new RegionFileWatcher(this);
this.markerTask = new UpdateMarkerData(this);
this.liveDataTask = new UpdateLiveData(this);
this.liveDataTask = new UpdateLiveData(this, Config.LIVE_UPDATE_THREADS);
}

protected void init() {
Expand Down
Loading