Combine foreground terrain controls and validate collector experiments

This commit is contained in:
Ludovic Marie
2026-10-04 00:53:12 +02:00
parent 5f6219a626
commit 33f9f5a5ef
20 changed files with 206 additions and 13 deletions
+49
View File
@@ -0,0 +1,49 @@
# Compare Java collectors
Use the balanced pack first with the launcher's existing JVM policy. Java 25
HotSpot supports explicit G1 (`-XX:+UseG1GC`) and ZGC (`-XX:+UseZGC`) selections;
the [Java command reference](https://docs.oracle.com/en/java/javase/25/docs/specs/man/java.html)
documents both. A collector choice can change CPU, heap headroom, collection
behavior and frame pacing. Lower pauses alone do not establish lower RAM or
higher FPS. The packs do not automatically select a collector.
For a Mac comparison, duplicate one instance. In Edit > Settings > Java, enable
the Java Arguments override checkbox. Preserve existing non-collector arguments,
but use exactly one collector selector in each instance. Choose G1 in one and
ZGC in the other. Use the same native Java 25 ARM64, maximum/minimum heap, compact
header setting, world copy, resolution, shaders, distances and warmed camera route.
Alternate at least three 120-second runs rather than comparing unrelated captures.
Remove the explicit selector to restore the launcher's policy, then restart.
The viewer shows the actual collector names captured by the game. Check them:
setting a launcher's text field does not establish which flags reached the VM.
Prism's per-instance Java Arguments and Memory settings have separate override
checkboxes. A global collector selection may need removal or replacement when
creating an explicit per-instance experiment.
Record FPS, slowest-1% rate, frame spikes, heap and process RSS together. RSS does
not represent all shared GPU memory on Apple Silicon. `gc_time_ms` sums collector
MXBean counters; concurrent cycles and overlapping phases can contribute, so it
is not a measured pause total. Use JFR root pause events for pause analysis.
The streaming reader is checked against the JDK's event exporter with both
default-GC and ZGC fixtures in CI on Windows, Linux and ARM macOS.
Developer demo and server launchers accept `--gc default`, `--gc g1` or `--gc zgc`.
For example:
```sh
python3 tools/runtime.py demo --instance .local/runtime/collector-test --heap 6G --gc zgc --compact-headers
python3 tools/server.py run --heap 4G --gc zgc
python3 tools/test_jfr.py --gc zgc
```
Prepare demo mods/worlds before comparing. The server retains its EULA requirement.
Options affect only the launched process; they do not change global Java settings.
The collector and compact-header experiments can be tested independently.
A local 3 GiB, compact-header ZGC client completed a 120-second game recording.
That recording also encountered a distant-terrain rejection storm. Its workload
and cache history differed from G1 captures, so the larger memory footprint and
different frame rate cannot be attributed to the collector alone. The dispatcher
experiment addresses the identified retry loop separately. No M2 collector
performance winner is established.
+1 -1
View File
@@ -9,7 +9,7 @@ Native renderer buffers and GPU allocations are outside this optimization.
## Try on your Mac
Import the balanced pack normally. In Prism, edit the instance's Java settings
and add `-XX:+UseCompactObjectHeaders` to its JVM arguments, retaining any existing
check the Java Arguments override box, and add `-XX:+UseCompactObjectHeaders` to its JVM arguments, retaining any existing
arguments. Use Java 25 HotSpot matching your CPU architecture. Restart the game.
Remove the argument to return to the launcher's default, or use
`-XX:-UseCompactObjectHeaders` to explicitly test the disabled mode. Do not supply
+30
View File
@@ -0,0 +1,30 @@
# Combined foreground-first experiments
`foreground-first` combines the adaptive background-terrain budget, precise
worker pacing, bounded/wakeable queue waits and rejected-dispatch retries.
`foreground-vulkan` uses the same combination with Vulkan preference and the
game's OpenGL fallback. Both retain balanced mods, 12 full-detail chunks,
128-chunk LOD radius, two DH workers and simulation distance 12.
The adaptive target is 120 FPS to suit the first M2 Pro/ProMotion testing target.
It is a heuristic frame-time goal, not an FPS cap or a guaranteed rate. The
controller reduces background duty cycle when frames fall behind that target
or heap pressure rises. This can delay distant-terrain completion. It cannot
identify whether GPU, CPU, disk, generation or other work caused a slow frame.
Uncapped game options do not override VSync, driver or display behavior.
Start with balanced, then compare the combined OpenGL profile at equal graphics,
heap and world settings. The individual profiles remain available for isolating
each hook. Compare `foreground-first` against `foreground-vulkan` only after the
isolated Vulkan pack works on the device. Each combined profile explicitly
enables all four controls; changing `/horizon adaptive off` disables only the
adaptive controller. Other hooks require their configuration flag and restart.
Change `targetFps` in `config/horizon-adaptive.properties` to evaluate a different
goal, then restart. The recorder captures the goal, actual applied hook flags,
backend and effective video settings. Java compact headers and collector changes
remain separate optional experiments. Normal simulation/tick rules are retained.
These profiles combine measured scheduler mechanisms, not independently measured
Minecraft FPS gains that can be added together. Their interaction, visible
terrain latency, memory and frame pacing need whole-game testing on real GPUs.
+17 -1
View File
@@ -22,6 +22,22 @@ Version 0.2.0 targets Minecraft 26.3 / Fabric 0.19.5 / Java 25. This is an initi
## Interpretation limits
The exact 0.10.0 JAR (SHA-256
`101790057c969333e2d9753640d4996649e8ced27e465897d8b6beab2474ed4c`)
ran the standalone dispatch-retry profile with 3 GiB heap and compact headers.
Its 120-second recording produced 568 frame intervals and 2,407 server ticks,
with matching CSV counts/means and 120/119 RSS samples. The actual frame report
retained custom graphics preset and 12/12 render/simulation distances, enabled
the dispatcher hook, and disabled adaptive/pacing/debounce/idle hooks. The world
saved, all three DH databases closed, worker threads stopped and the client quit.
The offline viewer read actual dispatch metadata, JVM settings, RSS and CSV.
Applied-hook fixtures verify exact task completion, independent-executor progress,
recovered slots and shutdown against the actual upstream rejection path in Linux
CI; Windows and ARM macOS compile the fixture. [Results and limits](dispatch-retry.md)
describe synthetic, caller-only failure-path measurements. An unchanged client
from the same saved world did not reproduce the earlier game allocation storm;
these variable captures do not prove a repeatable game-FPS or RAM improvement.
The exact 0.9.0 JAR (SHA-256
`2c5a731d4c93df427cc6054f120a52bf9456b3343b94ad9b79de1584b14d783f`)
ran the combined queue/adaptive/pacing profile with a 3 GiB heap and compact
@@ -73,7 +89,7 @@ continued updating, and worlds/databases/workers closed cleanly. The actual
publisher queue microbenchmark passes identity/priority/count checks on Linux,
Windows and Apple Silicon macOS; its raw results and timing overshoot are documented
in [the queue experiment](debounce-queue.md). These are separate from game-FPS,
block-update-latency or RAM-reduction claims. All twelve pack overrides retain
block-update-latency or RAM-reduction claims. All fourteen pack overrides retain
simulation distance 12 and explicitly set the intended experimental flags.
The 0.6.0 resident-memory sampler ran in the actual adaptive-pacing demo world.
+5
View File
@@ -37,6 +37,11 @@ when comparing peaks. Process CPU counters cover the whole process over the
recording wall time, including native work and the integrated server; they do
not identify which thread or mod caused CPU use.
`gc_time_ms` sums collector MXBean collection-time counters. With concurrent
collectors these can include cycle duration and overlapping phases; it is not a
direct stop-the-world pause measurement. The viewer calls it collection time.
Use [JFR pause events](profiling.md) when investigating GC-induced stalls.
The native-read test exercises the real library, overlapping recordings,
background execution, idle cancellation and unavailable-reader behavior on
the build platform. This validates measurement availability, not an FPS or
+5
View File
@@ -40,6 +40,11 @@ Reports capture the actual compact object header flag and collector names.
Compare against the same workload with the flag omitted; object allocation
changes do not establish a whole-server RAM/TPS gain.
Optional collector comparison: select --gc g1 or --gc zgc on the run command.
Match world, player activity, heap, Java and header mode; use one collector at a
time. gc_time_ms includes collector cycle accounting, not a measured pause total.
Use JFR pause events for pause analysis and compare RSS/CPU/TPS together.
Compare generated reports:
python3 tools/compare_benchmarks.py baseline-ticks.json optimized-ticks.json --strict
+32
View File
@@ -0,0 +1,32 @@
# Compare the Vulkan renderer on your Mac
The `vulkan` profile asks Minecraft 26.3 to use its existing Vulkan backend, with
its original OpenGL fallback. It uses balanced mods/distances and omits Iris.
The game renderer handles the backend; this project has not written a separate
Metal renderer. The benchmark records the actual backend and driver.
The checksum-verified 26.3 manifest includes LWJGL Vulkan 3.4.3 Mac ARM64 natives.
Inspecting that official native JAR confirmed `libMoltenVK.dylib`; its paired
LWJGL loader first tries MoltenVK on macOS. [MoltenVK](https://github.com/KhronosGroup/MoltenVK)
implements Vulkan functionality over Apple's Metal framework. This verifies a
bundled route to Metal, rather than proving that a particular Mac backend starts
or performs better. No separately installed Vulkan SDK is required for the bundled
library; driver/backend compatibility still needs a real Mac test.
Import `m2-balanced` and `vulkan` as separate Prism instances. Keep Java 25 ARM64,
heap, header/collector flags, world copies, resolution, view/simulation distance
and camera route equal. Warm terrain and shader/pipeline caches before comparing.
Run at least three alternating 120-second F8 recordings. Inspect nearby blocks,
distant terrain, transparency, water, lighting and reloads as well as timings.
Use the viewer's actual backend field: OpenGL fallback is an OpenGL result.
After the isolated test works, `foreground-first` and `foreground-vulkan` compare
the two backends with the same combined terrain controls. Their 120 FPS adaptive
goal controls background duty cycle; rendering remains uncapped in pack options.
Do not add Iris or shaders to one side of an isolated backend comparison.
Linux software rendering checks reached the actual Vulkan backend, rendered the
demo world and recorded matching CSV/JSON frame/tick samples. An unavailable
Vulkan-driver test reached the menu using OpenGL fallback. These tests do not
validate MoltenVK, real GPU speeds, all visual details or macOS 27. The user's
M2 Pro remains the priority device for those checks.