Merge pull request #12 from ludovic111/collector-validation
Combine foreground terrain controls and compare Java collector settings
This commit is contained in:
@@ -45,6 +45,8 @@ jobs:
|
||||
run: python tools/build_mod.py
|
||||
- name: Verify streaming JFR analysis against the JDK exporter
|
||||
run: python tools/test_jfr.py
|
||||
- name: Verify ZGC pause and allocation event interpretation
|
||||
run: python tools/test_jfr.py --gc zgc
|
||||
- name: Build pinned portable packs
|
||||
run: python tools/build_pack.py
|
||||
- name: Measure isolated worker pacing on this platform
|
||||
|
||||
@@ -6,7 +6,7 @@ Client-first performance research for Minecraft Java **26.3**, preserving vanill
|
||||
|
||||
## Play on your Mac
|
||||
|
||||
Download **horizon-mac-starter-0.10.0.zip** from [Releases](https://github.com/ludovic111/minecraft-optimization-lab/releases), extract it and open `Mac-Start.command`. It verifies and installs official universal Prism Launcher in `~/Applications` if needed, then opens the balanced pack import. Sign into Microsoft **inside Prism yourself**. This project needs no credentials.
|
||||
Download **horizon-mac-starter-0.11.0.zip** from [Releases](https://github.com/ludovic111/minecraft-optimization-lab/releases), extract it and open `Mac-Start.command`. It verifies and installs official universal Prism Launcher in `~/Applications` if needed, then opens the balanced pack import. Sign into Microsoft **inside Prism yourself**. This project needs no credentials.
|
||||
|
||||
Use native **Java 25 ARM64**, maximum heap **6144 MiB**, minimum **512 MiB** on your 16 GB M2 Pro. Prism can download Java automatically. Start at 1280×800 or 1920×1200; full Retina resolution is a larger GPU workload. [START-HERE.txt](packs/START-HERE.txt) has details. The same `.mrpack` files import into Prism on Windows and Linux.
|
||||
|
||||
@@ -20,6 +20,8 @@ Use native **Java 25 ARM64**, maximum heap **6144 MiB**, minimum **512 MiB** on
|
||||
| queue-wait (experimental) | 12 | 128 | 6144 MiB |
|
||||
| adaptive-queue (experimental) | 12 | 128 | 6144 MiB |
|
||||
| dispatch-retry (experimental) | 12 | 128 | 6144 MiB |
|
||||
| foreground-first (combined experiment) | 12 | 128 | 6144 MiB |
|
||||
| foreground-vulkan (combined experiment) | 12 | 128 | 6144 MiB |
|
||||
| low-memory | 8 | none | 3072 MiB |
|
||||
| far-distance | 12 | 256 | 8192 MiB, with sufficient physical RAM |
|
||||
| cinematic | 12 | 128 | 6144 MiB |
|
||||
@@ -31,6 +33,11 @@ Distant LOD is simplified terrain. Nearby blocks retain full detail. Initial gen
|
||||
|
||||
The optional `queue-wait` pack yields during pending distant-terrain debounce retries; `adaptive-queue` combines it with the existing controllers. [Queue experiment and measurement limits](docs/debounce-queue.md).
|
||||
|
||||
Version 0.11 adds combined foreground-first OpenGL/Vulkan profiles with a 120 FPS
|
||||
adaptive goal, plus explicit collector experiments and GC measurement guidance.
|
||||
See [combined controls](docs/foreground-first.md), [Vulkan on your Mac](docs/vulkan.md)
|
||||
and [collector comparisons](docs/collectors.md). The frame goal is not a rendering cap.
|
||||
|
||||
Version 0.10 adds an isolated [rejected-dispatch retry experiment](docs/dispatch-retry.md).
|
||||
It bounds retry passes when a DH worker rejects queued work, preserving original
|
||||
requeue handling and allowing other executors to progress. Balanced keeps it off.
|
||||
@@ -82,7 +89,7 @@ python3 tools/build_mod.py
|
||||
python3 tools/build_release.py
|
||||
```
|
||||
|
||||
Gitignored `dist/` contains twelve packs, our original instrumentation JAR, client/server starter ZIPs and SHA256SUMS. [mods.lock.json](packs/mods.lock.json) pins mod versions, exact dependency closure, SHA-1/SHA-512 and source/license; [fabric.lock.json](packs/fabric.lock.json) pins loader/library SHA-256. Packs use the [Modrinth format](https://support.modrinth.com/en/articles/8802351-modrinth-modpack-format-mrpack). They embed only original project code; third-party mods, game and assets download from their publishers.
|
||||
Gitignored `dist/` contains fourteen packs, our original instrumentation JAR, client/server starter ZIPs and SHA256SUMS. [mods.lock.json](packs/mods.lock.json) pins mod versions, exact dependency closure, SHA-1/SHA-512 and source/license; [fabric.lock.json](packs/fabric.lock.json) pins loader/library SHA-256. Packs use the [Modrinth format](https://support.modrinth.com/en/articles/8802351-modrinth-modpack-format-mrpack). They embed only original project code; third-party mods, game and assets download from their publishers.
|
||||
|
||||
The server starter uses Lithium/FerriteCore and `/horizonserver bench <label> <seconds>`. [Server instructions](docs/server-quickstart.txt) cover setup and a baseline. Files are prepared before you accept Minecraft's EULA locally. A 50-active-player workload remains to be measured.
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
@@ -22,6 +22,41 @@ Version 0.2.0 targets Minecraft 26.3 / Fabric 0.19.5 / Java 25. This is an initi
|
||||
|
||||
## Interpretation limits
|
||||
|
||||
The exact 0.11.0 JAR (SHA-256
|
||||
`c2f59ca0b2f1e356f51b41cd0d9f1d98d6b86e240f5b5a1424f27de57f0e9c4a`)
|
||||
ran `foreground-first` with an explicit G1 collector, compact headers and 3 GiB
|
||||
heap. Its 120-second OpenGL world capture produced 640 frame intervals and
|
||||
2,401 server ticks with matching CSV counts/means and 120 RSS samples each.
|
||||
All four controls and the wakeable idle path were reported enabled, with adaptive
|
||||
goal 120 FPS, uncapped rendering and actual distances 12/12. World saves, all
|
||||
three DH database closures, worker shutdown and client quit completed. The offline
|
||||
viewer displayed the actual combined state, goal/cap distinction and collector
|
||||
accounting guidance. These software-rendered checks validate integration rather
|
||||
than establishing M2 FPS, RAM, LOD-completion or real-GPU visual improvements.
|
||||
|
||||
The same exact JAR then ran `foreground-vulkan` with all controls enabled,
|
||||
adaptive goal 120, uncapped rendering and distances 12/12. The actual Vulkan
|
||||
backend and driver were captured. Its 120-second recording produced 618 frame
|
||||
intervals and 2,413 server ticks with matching CSV counts/means and 120 RSS
|
||||
samples each. This verifies the combination on Linux software Vulkan; it does
|
||||
not validate MoltenVK, all distant-geometry visuals or GPU performance on the Mac.
|
||||
|
||||
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 +108,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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -17,6 +17,7 @@ import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Options;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommands.argument;
|
||||
@@ -100,6 +101,7 @@ public final class HorizonClient implements ClientModInitializer {
|
||||
context.put("simulation_distance", client.options.simulationDistance().get());
|
||||
context.put("vsync", client.options.enableVsync().get());
|
||||
context.put("fps_limit", client.options.framerateLimit().get());
|
||||
context.put("fps_limit_unlimited", client.options.framerateLimit().get() >= Options.UNLIMITED_FRAMERATE_CUTOFF);
|
||||
context.put("framebuffer_width", client.getWindow().getWidth());
|
||||
context.put("framebuffer_height", client.getWindow().getHeight());
|
||||
var device = RenderSystem.getDevice().getDeviceInfo();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "horizonlab",
|
||||
"version": "0.10.0",
|
||||
"version": "0.11.0",
|
||||
"name": "Horizon Lab",
|
||||
"description": "Client frame pacing and server tick measurements for reproducible optimization experiments.",
|
||||
"authors": [
|
||||
|
||||
@@ -58,6 +58,14 @@ PROFILES
|
||||
This is a separate experiment: adaptive, worker-pacing and queue-wait are off.
|
||||
Set enabled=false in config/horizon-dispatch-retry.properties and restart
|
||||
to disable it. A synthetic applied-hook test checks exact task completion.
|
||||
- foreground-first: combines adaptive terrain, precise pacing, wakeable queue
|
||||
waits and bounded rejected dispatch retries. Uses OpenGL and a 120 FPS
|
||||
adaptive goal. This is not an FPS cap; terrain may take longer to appear.
|
||||
- foreground-vulkan: the same combined controls with Vulkan preference and
|
||||
OpenGL fallback. On Apple Silicon the game bundles a MoltenVK library.
|
||||
Test the isolated vulkan pack first, then compare both combined profiles
|
||||
using equal worlds, heap, resolution and camera routes. Check the actual
|
||||
backend in the benchmark viewer; a fallback is not a Vulkan result.
|
||||
- low-memory: 8 full-detail chunks, no LOD. Set maximum memory 3072 MiB.
|
||||
For a matched comparison set both instances to the same render distance.
|
||||
- far-distance: 12 full-detail plus 256 LOD chunks. Start with 8192 MiB ONLY on
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"minecraft": "26.3",
|
||||
"java_major": 25,
|
||||
"fabric_loader": "0.19.5",
|
||||
"pack_version": "0.10.0",
|
||||
"pack_version": "0.11.0",
|
||||
"options_data_version": 5023,
|
||||
"projects": {
|
||||
"sodium": {
|
||||
|
||||
+14
-1
@@ -54,7 +54,7 @@ class PackTests(unittest.TestCase):
|
||||
for name, profile in build_pack.PROFILES.items():
|
||||
files = build_pack.overrides(name, b"original fixture")
|
||||
dispatch = files["config/horizon-dispatch-retry.properties"].decode()
|
||||
self.assertEqual(dispatch, "enabled=true\n" if name == "dispatch-retry" else "enabled=false\n")
|
||||
self.assertEqual(dispatch, "enabled=true\n" if name in {"dispatch-retry", "foreground-first", "foreground-vulkan"} else "enabled=false\n")
|
||||
if name == "dispatch-retry":
|
||||
for setting in ["worker-pacing", "queue-wait"]:
|
||||
self.assertEqual(files[f"config/horizon-{setting}.properties"], b"enabled=false\n")
|
||||
@@ -62,6 +62,19 @@ class PackTests(unittest.TestCase):
|
||||
self.assertEqual(files["config/DistantHorizons.toml"],
|
||||
build_pack.overrides("m2-balanced", b"original fixture")["config/DistantHorizons.toml"])
|
||||
|
||||
def test_combined_profiles_enable_all_controls_without_changing_simulation(self):
|
||||
for name, backend in [("foreground-first", "opengl"), ("foreground-vulkan", "vulkan")]:
|
||||
files = build_pack.overrides(name, b"original fixture")
|
||||
self.assertEqual(files["config/horizon-adaptive.properties"], b"enabled=true\ntargetFps=120\n")
|
||||
for key in ["worker-pacing", "queue-wait", "dispatch-retry"]:
|
||||
self.assertEqual(files[f"config/horizon-{key}.properties"], b"enabled=true\n")
|
||||
options = dict(line.split(":", 1) for line in files["options.txt"].decode().splitlines())
|
||||
self.assertEqual(options["simulationDistance"], "12")
|
||||
self.assertEqual(options["renderDistance"], "12")
|
||||
self.assertEqual(options["maxFps"], "260")
|
||||
self.assertEqual(json.loads(options["preferredGraphicsBackend"]), backend)
|
||||
self.assertNotIn("config/iris.properties", files)
|
||||
|
||||
def test_wrong_game_or_download_path_is_rejected(self):
|
||||
for field, value in [("game_versions", ["1.21"]), ("filename", "../bad.jar"), ("url", "http://unsafe.invalid")]:
|
||||
lock = copy.deepcopy(build_pack.read_lock())
|
||||
|
||||
@@ -91,6 +91,7 @@ function compareReports(a,b){
|
||||
rows.push({label:'GC collection time / second',key:'gc_collection_ms_per_second',unit:'ms/s',baseline:av,candidate:bv,change_percent:av?100*(bv/av-1):null});
|
||||
}
|
||||
warnings.push('Memory peaks are sampled and can miss short spikes. RSS includes resident JVM and native pages, but is not a complete GPU/unified-memory measurement. Heap/nonheap measure JVM pools only. CPU includes the whole process and integrated server.');
|
||||
warnings.push('GC collection time comes from collector MXBean counters. It may include concurrent cycles and overlapping collector phases; it is not a measured stop-the-world pause total. Use JFR pause events for that comparison.');
|
||||
for(const [label,r] of [['Baseline',a],['Candidate',b]])if(number(r.process_rss_last_sample_age_ms)&&r.process_rss_last_sample_age_ms>2500)warnings.push(label+' resident-memory sample is '+format(r.process_rss_last_sample_age_ms/1000)+' seconds old. The background reader may be slow or unavailable.');
|
||||
return{kind:a.kind,differences,warnings,metrics:rows};
|
||||
}
|
||||
@@ -100,6 +101,10 @@ function renderDetails(side){
|
||||
const r=entry.report,fields=[['Profile',r.profile||r.label||'Unlabeled'],['Recording',format(r.elapsed_seconds)+' s · '+format(r.stats.count)+' samples'],['Platform',[r.os,r.architecture].filter(Boolean).join(' ')||'Not captured']];
|
||||
if(r.kind==='frames')fields.push(['Graphics',[r.gpu,r.graphics_backend].filter(Boolean).join(' · ')||'Not captured'],['Window',number(r.framebuffer_width)?r.framebuffer_width+' × '+r.framebuffer_height:'Not captured'],['Experiments','Adaptive: '+(r.adaptive_budget_enabled?'on':'off')+' · precise pacing: '+(r.precise_worker_pacing?'on':'off')+' · queue wait: '+(r.debounce_queue_wait?'on':'off')]);
|
||||
fields.push(['JVM', 'Compact headers: '+(r.compact_object_headers===true?'on':r.compact_object_headers===false?'off':'not captured')+' · GC: '+(Array.isArray(r.garbage_collectors)?r.garbage_collectors.join(', '):'not captured')]);
|
||||
if(r.kind==='frames'){
|
||||
fields.push(['Frame limit',r.fps_limit_unlimited===true||(r.minecraft==='26.3'&&number(r.fps_limit)&&r.fps_limit>=260)?'Uncapped':number(r.fps_limit)?r.fps_limit+' FPS':'not captured']);
|
||||
if(r.adaptive_budget_enabled&&number(r.adaptive_target_fps))fields.push(['Adaptive frame goal',r.adaptive_target_fps+' FPS (not a cap)']);
|
||||
}
|
||||
fields.push(['Rejected dispatch retry', r.dispatch_retry_backoff===true?'on':r.dispatch_retry_backoff===false?'off':'not captured']);
|
||||
fields.push(['Wakeable queue idle', r.wakeable_idle_wait===true?'on':r.wakeable_idle_wait===false?'off':'not captured']);
|
||||
for(const [label,value]of fields)target.append(text('dt',label),text('dd',value));
|
||||
|
||||
@@ -31,6 +31,8 @@ def test_metrics():
|
||||
subprocess.run(["java", "-cp", str(destination), "dev.horizonlab.metrics.MetricsTest"], check=True)
|
||||
subprocess.run(["java", "-XX:+UseCompactObjectHeaders", "-cp", str(destination),
|
||||
"dev.horizonlab.metrics.MetricsTest"], check=True)
|
||||
subprocess.run(["java", "-Xms32M", "-Xmx256M", "-XX:+UseZGC", "-XX:+UseCompactObjectHeaders", "-cp", str(destination),
|
||||
"dev.horizonlab.metrics.MetricsTest"], check=True)
|
||||
budget_sources = [SOURCE / "main/java/dev/horizonlab/budget/TerrainBudget.java",
|
||||
SOURCE / "test/java/dev/horizonlab/budget/TerrainBudgetTest.java"]
|
||||
subprocess.run(["javac", "--release", "25", "-d", str(destination), *map(str, budget_sources)], check=True)
|
||||
|
||||
+3
-1
@@ -24,6 +24,8 @@ PROFILES = {
|
||||
"queue-wait": {"title": "Debounce queue wait experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "queue_wait": True},
|
||||
"adaptive-queue": {"title": "Adaptive pacing and queue wait experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "adaptive": True, "pacing": True, "queue_wait": True},
|
||||
"dispatch-retry": {"title": "Rejected dispatch retry experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "dispatch_retry": True},
|
||||
"foreground-first": {"title": "Foreground-first combined experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "adaptive": True, "pacing": True, "queue_wait": True, "dispatch_retry": True, "target_fps": 120},
|
||||
"foreground-vulkan": {"title": "Foreground-first Vulkan experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "adaptive": True, "pacing": True, "queue_wait": True, "dispatch_retry": True, "target_fps": 120, "backend": "vulkan"},
|
||||
"low-memory": {"title": "Low memory", "mods": CORE, "render": 8, "lod": 0, "heap": 3072},
|
||||
"far-distance": {"title": "Far distance", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 256, "heap": 8192},
|
||||
"cinematic": {"title": "Cinematic (optional)", "mods": CORE + ["distanthorizons", "iris", "complementary-reimagined"], "render": 12, "lod": 128, "heap": 6144},
|
||||
@@ -80,7 +82,7 @@ def overrides(profile_name, mod_bytes):
|
||||
experiment = any(profile.get(key, False) for key in ["adaptive", "pacing", "queue_wait", "dispatch_retry"])
|
||||
config = ROOT / "packs/config" / f"{'m2-balanced' if experiment else profile_name}.toml"
|
||||
files["config/horizon-adaptive.properties"] = (
|
||||
f"enabled={str(profile.get('adaptive', False)).lower()}\ntargetFps=60\n").encode()
|
||||
f"enabled={str(profile.get('adaptive', False)).lower()}\ntargetFps={profile.get('target_fps', 60)}\n").encode()
|
||||
files["config/horizon-worker-pacing.properties"] = (
|
||||
f"enabled={str(profile.get('pacing', False)).lower()}\n").encode()
|
||||
files["config/horizon-queue-wait.properties"] = (
|
||||
|
||||
+11
-1
@@ -42,6 +42,15 @@ def install_original_mod(source, mod_dir, filename=None):
|
||||
CACHE = ROOT / ".local" / "runtime"
|
||||
|
||||
|
||||
def jvm_options(heap, compact_headers=False, collector="default"):
|
||||
options = ["-Xms512M", f"-Xmx{heap}"]
|
||||
if compact_headers:
|
||||
options.append("-XX:+UseCompactObjectHeaders")
|
||||
if collector != "default":
|
||||
options.append({"g1": "-XX:+UseG1GC", "zgc": "-XX:+UseZGC"}[collector])
|
||||
return options
|
||||
|
||||
|
||||
def fetch(url, path, checksum, algorithm="sha1"):
|
||||
for attempt in range(3):
|
||||
try:
|
||||
@@ -138,6 +147,7 @@ def main():
|
||||
parser.add_argument("--instance", type=Path, default=CACHE / "demo")
|
||||
parser.add_argument("--heap", default="4G")
|
||||
parser.add_argument("--compact-headers", action="store_true", help="Enable Java 25 compact object headers for this demo process")
|
||||
parser.add_argument("--gc", choices=["default", "g1", "zgc"], default="default", help="Select a collector for this process; default leaves JVM policy in use")
|
||||
args = parser.parse_args()
|
||||
if not re.fullmatch(r"[1-9][0-9]*[MGmg]", args.heap):
|
||||
parser.error("--heap must look like 4G")
|
||||
@@ -146,7 +156,7 @@ def main():
|
||||
return
|
||||
instance = args.instance.resolve()
|
||||
instance.mkdir(parents=True, exist_ok=True)
|
||||
command = ["java", "-Xms512M", f"-Xmx{args.heap}", *(["-XX:+UseCompactObjectHeaders"] if args.compact_headers else []),
|
||||
command = ["java", *jvm_options(args.heap, args.compact_headers, args.gc),
|
||||
"--enable-native-access=ALL-UNNAMED",
|
||||
f"-Djava.library.path={natives}", f"-Dorg.lwjgl.system.SharedLibraryExtractPath={natives}",
|
||||
"-Dfabric.log.disableAnsi=true", "-cp", os.pathsep.join(map(str, jars)),
|
||||
|
||||
+2
-1
@@ -51,6 +51,7 @@ def main():
|
||||
parser.add_argument("--heap", default="4G")
|
||||
parser.add_argument("--baseline", action="store_true", help="Use a separate instance for the baseline")
|
||||
parser.add_argument("--compact-headers", action="store_true", help="Enable Java 25 compact object headers for this server process")
|
||||
parser.add_argument("--gc", choices=["default", "g1", "zgc"], default="default", help="Select a collector for this process; default leaves JVM policy in use")
|
||||
args = parser.parse_args()
|
||||
if not re.fullmatch(r"[1-9][0-9]*[MGmg]", args.heap):
|
||||
parser.error("--heap must look like 4G")
|
||||
@@ -67,7 +68,7 @@ def main():
|
||||
eula.write_text("# Read https://www.minecraft.net/eula then change this value yourself.\neula=false\n")
|
||||
print(f"Server prepared. Read Minecraft's EULA and set eula=true in {eula} before running.")
|
||||
return
|
||||
subprocess.run(["java", "-Xms512M", f"-Xmx{args.heap}", *(["-XX:+UseCompactObjectHeaders"] if args.compact_headers else []),
|
||||
subprocess.run(["java", *runtime.jvm_options(args.heap, args.compact_headers, args.gc),
|
||||
"--enable-native-access=ALL-UNNAMED",
|
||||
"-cp", os.pathsep.join(map(str, libraries)), "net.fabricmc.loader.impl.launch.knot.KnotServer",
|
||||
"--nogui"], cwd=instance, check=True)
|
||||
|
||||
+7
-3
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verify the streaming JFR reader against the JDK's own JSON exporter."""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
@@ -9,10 +10,11 @@ ROOT = Path(__file__).resolve().parents[1]
|
||||
BUILD = ROOT / ".local/jfr-tests"
|
||||
|
||||
|
||||
def main():
|
||||
def main(collector="default"):
|
||||
BUILD.mkdir(parents=True, exist_ok=True)
|
||||
fixture = BUILD / "fixture.jfr"
|
||||
subprocess.run(["java", "-Xmx128M", str(ROOT / "tests/java/JfrFixture.java"), str(fixture)], check=True)
|
||||
gc_flags = ["-XX:+UseZGC"] if collector == "zgc" else []
|
||||
subprocess.run(["java", "-Xmx128M", *gc_flags, str(ROOT / "tests/java/JfrFixture.java"), str(fixture)], check=True)
|
||||
summary = json.loads(subprocess.check_output(
|
||||
["java", str(ROOT / "tools/JfrSummary.java"), str(fixture)], text=True))
|
||||
events = json.loads(subprocess.check_output(
|
||||
@@ -65,4 +67,6 @@ def main():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--gc", choices=["default", "zgc"], default="default")
|
||||
main(parser.parse_args().gc)
|
||||
|
||||
Reference in New Issue
Block a user