From 4bf82ef5307547f76ec3c4195bfa30f241807454 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 3 Oct 2026 23:06:36 +0200 Subject: [PATCH 1/2] Preserve fresh render budgets and measure compact Java headers --- .github/workflows/ci.yml | 3 + README.md | 7 +- docs/compact-headers.md | 67 +++++++++++++++++++ docs/server-quickstart.txt | 7 +- .../dev/horizonlab/metrics/Recording.java | 9 +++ .../src/main/resources/fabric.mod.json | 2 +- .../dev/horizonlab/metrics/MetricsTest.java | 6 ++ .../metrics/ObjectHeaderBenchmark.java | 59 ++++++++++++++++ packs/START-HERE.txt | 12 ++++ packs/mods.lock.json | 2 +- tests/test_packs.py | 14 ++++ tools/Compare-Benchmarks.html | 5 ++ tools/build_mod.py | 33 ++++++++- tools/build_pack.py | 2 +- tools/build_release.py | 2 +- tools/compare_benchmarks.py | 5 ++ tools/runtime.py | 4 +- tools/server.py | 4 +- 18 files changed, 233 insertions(+), 10 deletions(-) create mode 100644 docs/compact-headers.md create mode 100644 mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ObjectHeaderBenchmark.java diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44fe02d35..4c78f12ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,8 @@ jobs: run: python -c "from tools.build_mod import benchmark_workers; benchmark_workers()" - name: Measure isolated debounce queue polling run: python -c "from tools.build_mod import benchmark_debounce; benchmark_debounce()" + - name: Measure object allocations with compact headers off and on + run: python -c "from tools.build_mod import benchmark_headers; benchmark_headers()" - name: Test pack integrity and comparisons run: python -m unittest discover -s tests -v - name: Upload original mod and pack manifests only @@ -59,3 +61,4 @@ jobs: dist/horizon-lab-*.jar dist/worker-pacing-benchmark.txt dist/debounce-queue-benchmark.txt + dist/object-header-benchmark.txt diff --git a/README.md b/README.md index da4e47968..6ed597b72 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Client-first performance research for Minecraft Java **26.3**, preserving vanill ## Play on your Mac -Download **horizon-mac-starter-0.7.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.8.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. @@ -30,6 +30,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.8 fixes a fresh-instance graphics preset that could override the selected +render distance. It also records actual GC/header settings and supports an optional +[compact object headers experiment](docs/compact-headers.md) for Java 25; packs +do not enable that JVM flag automatically. + ## Measure on your hardware The optional [adaptive terrain experiment](docs/adaptive-terrain.md) throttles distant diff --git a/docs/compact-headers.md b/docs/compact-headers.md new file mode 100644 index 000000000..03b814a85 --- /dev/null +++ b/docs/compact-headers.md @@ -0,0 +1,67 @@ +# Compact object headers experiment + +Java 25 HotSpot offers `-XX:+UseCompactObjectHeaders`. This changes object-header +representation without replacing game logic. Oracle documents the header format +and enable flag in its [Java 25 GC guide](https://docs.oracle.com/en/java/javase/25/gctuning/other-considerations.html). +Object alignment and fields determine whether a particular allocation gets smaller. +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 +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 +both flags. Packs do not automatically enable this option. + +For an isolated comparison, duplicate the same balanced instance and use explicit +off/on flags. Keep collector, heap, world copy, camera route and all video settings +matched. Alternate at least three warmed 120-second recordings. The 0.8 recorder +captures the actual `compact_object_headers` setting and `garbage_collectors` names; +check these in the offline viewer. Older reports show "not captured", rather than +an assumed default. Launcher and JVM defaults can differ. + +Local demo and server tools accept `--compact-headers`. This enables the option +only in that process. The server still requires local EULA acceptance before it runs. + +## Isolated allocation measurement + +```sh +python3 tools/build_mod.py --benchmark-headers +``` + +The original benchmark uses the verified game/Distant Horizons publisher types +on its classpath, without redistributing them. It forks separate JVMs with explicit +off/on flags three times. Each type gets three discarded warm-up batches followed +by three measured batches of 100,000 objects. `ThreadMXBean` counts allocated bytes; +reference-array storage is allocated before measurement. Objects escape through a +volatile array, and their values are checked after measurement. The benchmark +asserts that the running VM reports the requested flag. Output includes Java/OS/CPU +architecture and goes to gitignored `dist/object-header-benchmark.txt`. + +The local Linux x64 Java 25 measurements yielded: + +| Type | Headers off, bytes/object | Headers on, bytes/object | +| --- | ---: | ---: | +| Minecraft `AABB` | 64 | 56 | +| Minecraft `Vec3` | 40 | 32 | +| Distant Horizons `DhChunkPos` | 24 | 24 | +| Boxed `Long`, outside cache | 24 | 16 | +| Plain `Object` | 16 | 8 | + +These are allocations for specific object layouts, not a measured reduction in +whole-game retained heap, process RSS, FPS or server TPS. Changing headers can +also change runtime tradeoffs. Real workloads and the user's M2 Pro remain the +decision point. CI runs the probe on Windows, Linux and Apple Silicon macOS and +runs the metric tests with compact headers enabled as well as the default. + +## Fresh video settings correction in 0.8 + +Minecraft 26.3 applies its selected graphics preset at startup. A fresh minimal +0.7 options file had the correct data-version marker but omitted an explicit +custom preset, allowing the default Fancy preset to override full-detail distance +to 16 chunks. Version 0.8 explicitly selects the custom preset so the pack's +12-chunk budget (8 in low-memory) is retained. This fixes configuration, without +reducing simulation distance or changing gameplay. Runtime reports capture the +effective settings; always compare those, not just pack labels. diff --git a/docs/server-quickstart.txt b/docs/server-quickstart.txt index 563f627d7..82c4fa30c 100644 --- a/docs/server-quickstart.txt +++ b/docs/server-quickstart.txt @@ -1,4 +1,4 @@ -Horizon server 0.2.0 — Minecraft 26.3, Fabric 0.19.5, Java 25 +Horizon server @PACK_VERSION@ — Minecraft 26.3, Fabric 0.19.5, Java 25 Install Python 3.10+ and native Java 25. Extract this ZIP and open a terminal here. @@ -35,6 +35,11 @@ chunk loading; repeat with 1, 10 and 100. Do not change simulation/view distance between matched runs or turn off game logic to manufacture a speedup. This first release has not been validated under a 50-player real workload. +Optional Java 25 HotSpot experiment: add --compact-headers to the run command. +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. + Compare generated reports: python3 tools/compare_benchmarks.py baseline-ticks.json optimized-ticks.json --strict diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Recording.java b/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Recording.java index efd7ab103..24dc904be 100644 --- a/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Recording.java +++ b/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Recording.java @@ -82,6 +82,15 @@ public final class Recording { metadata.put("os_version", System.getProperty("os.version")); metadata.put("architecture", System.getProperty("os.arch")); metadata.put("logical_processors", Runtime.getRuntime().availableProcessors()); + metadata.put("garbage_collectors", ManagementFactory.getGarbageCollectorMXBeans().stream() + .map(java.lang.management.MemoryManagerMXBean::getName).sorted().toList()); + try { + var diagnostic = ManagementFactory.getPlatformMXBean(com.sun.management.HotSpotDiagnosticMXBean.class); + if (diagnostic != null) metadata.put("compact_object_headers", + Boolean.parseBoolean(diagnostic.getVMOption("UseCompactObjectHeaders").getValue())); + } catch (RuntimeException | LinkageError unavailable) { + // Other VM implementations may not expose this option; absence is distinct from false. + } var endHeap = memory.getHeapMemoryUsage(); peakHeap = Math.max(peakHeap, endHeap.getUsed()); metadata.put("heap_used_end_bytes", endHeap.getUsed()); diff --git a/mods/horizon-lab/src/main/resources/fabric.mod.json b/mods/horizon-lab/src/main/resources/fabric.mod.json index 665f1fee9..5adc82208 100644 --- a/mods/horizon-lab/src/main/resources/fabric.mod.json +++ b/mods/horizon-lab/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "horizonlab", - "version": "0.7.0", + "version": "0.8.0", "name": "Horizon Lab", "description": "Client frame pacing and server tick measurements for reproducible optimization experiments.", "authors": [ diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/MetricsTest.java b/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/MetricsTest.java index 87c82ce58..d11904320 100644 --- a/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/MetricsTest.java +++ b/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/MetricsTest.java @@ -28,6 +28,12 @@ public final class MetricsTest { check((long) snapshot.metadata().get("heap_used_peak_sampled_bytes") >= (long) snapshot.metadata().get("heap_used_end_bytes"), "heap peak includes the final sample"); check((int) snapshot.metadata().get("resource_samples") >= 2, "start/end resource snapshots"); + check(snapshot.metadata().get("garbage_collectors") instanceof java.util.List, "collector configuration captured"); + var diagnostic = java.lang.management.ManagementFactory.getPlatformMXBean(com.sun.management.HotSpotDiagnosticMXBean.class); + if (diagnostic != null) { + boolean actual = Boolean.parseBoolean(diagnostic.getVMOption("UseCompactObjectHeaders").getValue()); + check(snapshot.metadata().get("compact_object_headers").equals(actual), "header option reflects the actual VM"); + } if (snapshot.metadata().containsKey("process_cpu_seconds")) { check((double) snapshot.metadata().get("process_cpu_seconds") >= 0, "CPU time is nonnegative"); } diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ObjectHeaderBenchmark.java b/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ObjectHeaderBenchmark.java new file mode 100644 index 000000000..0b0bb28a8 --- /dev/null +++ b/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ObjectHeaderBenchmark.java @@ -0,0 +1,59 @@ +package dev.horizonlab.metrics; + +import com.seibel.distanthorizons.core.pos.DhChunkPos; +import com.sun.management.HotSpotDiagnosticMXBean; +import java.lang.management.ManagementFactory; +import java.util.Locale; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; + +/** Actual publisher types in an isolated JVM; allocated bytes are not retained game RAM. */ +public final class ObjectHeaderBenchmark { + private static volatile Object[] retained; + private static final int COUNT = 100_000; + + private static void measure(int kind, boolean report) { + Object[] values = new Object[COUNT]; // Reference storage excluded from the counter. + var threads = (com.sun.management.ThreadMXBean) ManagementFactory.getThreadMXBean(); + if (!threads.isThreadAllocatedMemorySupported()) + throw new IllegalStateException("Thread allocation accounting unavailable"); + threads.setThreadAllocatedMemoryEnabled(true); + long id = Thread.currentThread().threadId(); + long start = threads.getThreadAllocatedBytes(id); + for (int i = 0; i < COUNT; i++) values[i] = switch (kind) { + case 0 -> new AABB(i, 0, 0, i + 1, 1, 1); + case 1 -> new Vec3(i, 2, 3); + case 2 -> new DhChunkPos(i, 0); + case 3 -> Long.valueOf(i + 1000L); // Outside the standard boxed-value cache. + default -> new Object(); + }; + retained = values; // Escaping objects must actually be materialized. + long bytes = threads.getThreadAllocatedBytes(id) - start; + if (bytes <= 0) throw new AssertionError("Missing allocation counter"); + for (int i = 0; i < COUNT; i++) { + boolean valid = switch (kind) { + case 0 -> ((AABB) values[i]).minX == i && ((AABB) values[i]).maxX == i + 1; + case 1 -> ((Vec3) values[i]).x == i && ((Vec3) values[i]).y == 2 && ((Vec3) values[i]).z == 3; + case 2 -> values[i].equals(new DhChunkPos(i, 0)); + case 3 -> ((Long) values[i]).longValue() == i + 1000L; + default -> values[i] != null && (i == 0 || values[i] != values[i - 1]); + }; + if (!valid) throw new AssertionError("Object values changed"); + } + if (report) System.out.printf(Locale.ROOT, + "type=%s objects=%d allocated_bytes=%d bytes_per_object=%.3f%n", + new String[]{"AABB", "Vec3", "DhChunkPos", "Long", "Object"}[kind], COUNT, bytes, (double) bytes / COUNT); + } + + public static void main(String[] args) { + var hotspot = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class); + boolean enabled = Boolean.parseBoolean(hotspot.getVMOption("UseCompactObjectHeaders").getValue()); + if (args.length != 1 || enabled != Boolean.parseBoolean(args[0])) + throw new AssertionError("JVM compact header setting does not match the requested mode"); + System.out.println("compact_object_headers=" + enabled); + for (int kind = 0; kind < 5; kind++) { + for (int warmup = 0; warmup < 3; warmup++) measure(kind, false); + for (int trial = 0; trial < 3; trial++) measure(kind, true); + } + } +} diff --git a/packs/START-HERE.txt b/packs/START-HERE.txt index 0d9f36bbf..49abce194 100644 --- a/packs/START-HERE.txt +++ b/packs/START-HERE.txt @@ -105,6 +105,18 @@ assess visual differences as well as speed. For collector experiments test Java 25's -XX:+UseZGC against its default G1 in both profiles; ZGC trades some CPU/memory for shorter pauses and is not an automatic win on a 16 GB machine. +OPTIONAL JAVA MEMORY EXPERIMENT +With Java 25 HotSpot, add -XX:+UseCompactObjectHeaders to the instance's Java JVM +arguments and restart. Retain your other arguments. Packs do not enable this flag +automatically. For a separate off/on test use duplicate balanced instances with +-XX:-UseCompactObjectHeaders and -XX:+UseCompactObjectHeaders respectively. +Use one flag at a time and keep the collector, heap and workload identical. +Reports and the offline viewer show the actual compact-header setting and GC. +Some object layouts shrink; others do not. Whole-game RAM/FPS gains need testing. + +Version 0.8 explicitly selects the custom graphics preset so Minecraft's startup +preset does not override the pack's render distance. Check the recorded settings. + This build is a playable Java optimization stack with original measurement code. It is NOT a completed Rust rewrite, a new custom renderer, or a measured M2 speedup. It has no gameplay feature additions and is intended to preserve vanilla rules; diff --git a/packs/mods.lock.json b/packs/mods.lock.json index 31386e075..edc1e9cf1 100644 --- a/packs/mods.lock.json +++ b/packs/mods.lock.json @@ -3,7 +3,7 @@ "minecraft": "26.3", "java_major": 25, "fabric_loader": "0.19.5", - "pack_version": "0.7.0", + "pack_version": "0.8.0", "options_data_version": 5023, "projects": { "sodium": { diff --git a/tests/test_packs.py b/tests/test_packs.py index 51c95623d..e9da45c4d 100644 --- a/tests/test_packs.py +++ b/tests/test_packs.py @@ -78,6 +78,8 @@ class PackTests(unittest.TestCase): # A missing/currently wrong version invokes the game's graphics API reset migration. self.assertEqual(options["version"], "5023") self.assertEqual(json.loads(options["preferredGraphicsBackend"]), "opengl") + # The default Fancy startup preset otherwise overwrites the requested view distance. + self.assertEqual(json.loads(options["graphicsPreset"]), "custom") for entry in index["files"]: self.assertEqual(set(entry["hashes"]), {"sha1", "sha512"}) self.assertTrue(entry["downloads"][0].startswith("https://cdn.modrinth.com/")) @@ -119,6 +121,18 @@ class ComparisonTests(unittest.TestCase): with self.assertRaises(ValueError): compare_benchmarks.compare(self.report(), other) + def test_jvm_experiment_warns_without_rejecting_an_intentional_change(self): + baseline = self.report() + baseline.update(compact_object_headers=False, garbage_collectors=["G1 Young Generation"]) + candidate = copy.deepcopy(baseline) + candidate["compact_object_headers"] = True + result = compare_benchmarks.compare(baseline, candidate) + self.assertEqual(result["mismatches"], []) + self.assertTrue(any("compact_object_headers differs" in warning for warning in result["warnings"])) + del candidate["compact_object_headers"] + result = compare_benchmarks.compare(baseline, candidate) + self.assertTrue(any("not captured" in warning for warning in result["warnings"])) + if __name__ == "__main__": unittest.main() diff --git a/tools/Compare-Benchmarks.html b/tools/Compare-Benchmarks.html index ced9646d6..56c619775 100644 --- a/tools/Compare-Benchmarks.html +++ b/tools/Compare-Benchmarks.html @@ -61,6 +61,10 @@ function compareReports(a,b){ const differences=SETTINGS.filter(key=>JSON.stringify(a[key])!==JSON.stringify(b[key])).map(key=>({setting:key,baseline:a[key]??null,candidate:b[key]??null})); if(a.kind==='ticks'&&a.peak_players!==b.peak_players)differences.push({setting:'peak_players',baseline:a.peak_players??null,candidate:b.peak_players??null}); const warnings=['World, camera route, shaders and terrain-cache warm-up still need to match. These are not verified by the captured settings.']; + for(const key of ['compact_object_headers','garbage_collectors']){ + if(!(key in a)||!(key in b))warnings.push(key+' was not captured in both reports; JVM configuration equivalence is unknown.'); + else if(JSON.stringify(a[key])!==JSON.stringify(b[key]))warnings.push('JVM '+key+' differs. Treat it as an explicit experiment variable.'); + } if(Math.abs(a.elapsed_seconds-b.elapsed_seconds)>Math.max(2,Math.min(a.elapsed_seconds,b.elapsed_seconds)*.1))warnings.push('Recording durations differ. Match durations when comparing memory peaks and collection totals.'); for(const [label,r] of [['Baseline',a],['Candidate',b]]){ if(r.elapsed_seconds<60)warnings.push(label+' recording is shorter than 60 seconds. Use longer repeated runs.'); @@ -95,6 +99,7 @@ function renderDetails(side){ if(!entry)return; 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')]); for(const [label,value]of fields)target.append(text('dt',label),text('dd',value)); } async function loadFiles(side,files){ diff --git a/tools/build_mod.py b/tools/build_mod.py index 78df3911a..2bb2a6f1f 100644 --- a/tools/build_mod.py +++ b/tools/build_mod.py @@ -29,6 +29,8 @@ def test_metrics(): sources.append(SOURCE / "test/java/dev/horizonlab/metrics/MetricsTest.java") subprocess.run(["javac", "--release", "25", "-d", str(destination), *map(str, sources)], check=True) 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) 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) @@ -141,15 +143,42 @@ def benchmark_debounce(): print(output.read_text(), end="") +def benchmark_headers(): + arguments = [json.loads(line) for line in (BUILD / "javac.args").read_text().splitlines()] + classpath = arguments[arguments.index("-classpath") + 1] + tests = BUILD / "header-benchmark" + tests.mkdir(parents=True, exist_ok=True) + subprocess.run(["javac", "--release", "25", "-proc:none", "-cp", classpath, + "-d", str(tests), str(SOURCE / "test/java/dev/horizonlab/metrics/ObjectHeaderBenchmark.java")], check=True) + output = ROOT / "dist/object-header-benchmark.txt" + with output.open("w", encoding="utf-8") as report: + report.write(f"Java {subprocess.check_output(['java', '--version'], text=True).splitlines()[0]}\n") + report.write(f"Platform {platform.system()} {platform.release()} {platform.machine()}; logical CPUs {os.cpu_count()}\n") + report.flush() + for repeat in range(3): + for enabled in [False, True]: + report.write(f"fork={repeat} requested_compact_headers={enabled}\n") + report.flush() + subprocess.run(["java", "-Xms128M", "-Xmx512M", + "-XX:" + ("+" if enabled else "-") + "UseCompactObjectHeaders", + "-cp", os.pathsep.join([str(tests), classpath]), + "dev.horizonlab.metrics.ObjectHeaderBenchmark", str(enabled).lower()], + stdout=report, check=True) + print(output.read_text(), end="") + + if __name__ == "__main__": parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--test-only", action="store_true") parser.add_argument("--benchmark-workers", action="store_true", help="Measure tiny-job executor pacing; not Minecraft FPS") + parser.add_argument("--benchmark-headers", action="store_true", help="Measure object allocation with compact headers off/on; not game RAM") args = parser.parse_args() - if args.test_only and args.benchmark_workers: - parser.error("--benchmark-workers requires the compiled mod; omit --test-only") + if args.test_only and (args.benchmark_workers or args.benchmark_headers): + parser.error("Benchmarks require the compiled mod; omit --test-only") test_metrics() if not args.test_only: build() if args.benchmark_workers: benchmark_workers() + if args.benchmark_headers: + benchmark_headers() diff --git a/tools/build_pack.py b/tools/build_pack.py index f8a2b7a87..0c46fe78c 100644 --- a/tools/build_pack.py +++ b/tools/build_pack.py @@ -64,7 +64,7 @@ def mod_path(entry): def options(profile): # Simulation distance stays at the vanilla default in every profile. - values = {"version": read_lock()["options_data_version"], + values = {"version": read_lock()["options_data_version"], "graphicsPreset": json.dumps("custom"), "renderDistance": profile["render"], "simulationDistance": 12, "enableVsync": "false", "maxFps": 260, "guiScale": 2, "onboardAccessibility": "false", "preferredGraphicsBackend": json.dumps(profile.get("backend", "opengl"))} diff --git a/tools/build_release.py b/tools/build_release.py index 7773488c9..8fe11fe55 100644 --- a/tools/build_release.py +++ b/tools/build_release.py @@ -29,7 +29,7 @@ def main(): build_pack.write_zip(ROOT / "dist" / f"horizon-mac-starter-{version}.zip", client) server = {"LICENSE": client["LICENSE"], "dist/" + mod.name: mod.read_bytes(), "Compare-Benchmarks.html": viewer, - "START-HERE.txt": (ROOT / "docs/server-quickstart.txt").read_bytes(), + "START-HERE.txt": (ROOT / "docs/server-quickstart.txt").read_text().replace("@PACK_VERSION@", version).encode(), "research-lock.json": (ROOT / "research-lock.json").read_bytes()} for name in ["lab.py", "runtime.py", "server.py", "compare_benchmarks.py"]: server["tools/" + name] = (ROOT / "tools" / name).read_bytes() diff --git a/tools/compare_benchmarks.py b/tools/compare_benchmarks.py index 6972945fc..d6fe77a7f 100644 --- a/tools/compare_benchmarks.py +++ b/tools/compare_benchmarks.py @@ -23,6 +23,11 @@ def compare(baseline, candidate): mismatches = [f"{key}: {baseline.get(key)!r} vs {candidate.get(key)!r}" for key in MATCH_FIELDS if baseline.get(key) != candidate.get(key)] warnings = ["World, route, warm-up, shader state and LOD cache must also match; these are not verified by this tool."] + for field in ["compact_object_headers", "garbage_collectors"]: + if field not in baseline or field not in candidate: + warnings.append(f"{field} was not captured in both reports; JVM configuration equivalence is unknown.") + elif baseline[field] != candidate[field]: + warnings.append(f"JVM {field} differs: {baseline[field]!r} vs {candidate[field]!r}. Treat this as an explicit experiment variable.") if abs(baseline.get("elapsed_seconds", 0) - candidate.get("elapsed_seconds", 0)) > max( 2, min(baseline.get("elapsed_seconds", 0), candidate.get("elapsed_seconds", 0)) * 0.1): warnings.append("Recording durations differ; match durations when comparing memory peaks and collection totals.") diff --git a/tools/runtime.py b/tools/runtime.py index 4942bf077..b3ea2099d 100644 --- a/tools/runtime.py +++ b/tools/runtime.py @@ -137,6 +137,7 @@ def main(): parser.add_argument("command", choices=["prepare", "demo"]) 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") args = parser.parse_args() if not re.fullmatch(r"[1-9][0-9]*[MGmg]", args.heap): parser.error("--heap must look like 4G") @@ -145,7 +146,8 @@ def main(): return instance = args.instance.resolve() instance.mkdir(parents=True, exist_ok=True) - command = ["java", "-Xms512M", f"-Xmx{args.heap}", "--enable-native-access=ALL-UNNAMED", + command = ["java", "-Xms512M", f"-Xmx{args.heap}", *(["-XX:+UseCompactObjectHeaders"] if args.compact_headers else []), + "--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)), "net.fabricmc.loader.impl.launch.knot.KnotClient", diff --git a/tools/server.py b/tools/server.py index d3b06143b..adba173e7 100644 --- a/tools/server.py +++ b/tools/server.py @@ -50,6 +50,7 @@ def main(): parser.add_argument("--instance", type=Path, default=ROOT / ".local/server/optimized") 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") args = parser.parse_args() if not re.fullmatch(r"[1-9][0-9]*[MGmg]", args.heap): parser.error("--heap must look like 4G") @@ -66,7 +67,8 @@ 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}", "--enable-native-access=ALL-UNNAMED", + subprocess.run(["java", "-Xms512M", f"-Xmx{args.heap}", *(["-XX:+UseCompactObjectHeaders"] if args.compact_headers else []), + "--enable-native-access=ALL-UNNAMED", "-cp", os.pathsep.join(map(str, libraries)), "net.fabricmc.loader.impl.launch.knot.KnotServer", "--nogui"], cwd=instance, check=True) From d61fa875e3c121cf9f26fe278fd825947b818992 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 3 Oct 2026 23:10:21 +0200 Subject: [PATCH 2/2] Record cross-platform header allocations and final runtime validation --- .../object-headers-2026-10-03/macos-26.txt | 104 ++++++++++++++++++ .../ubuntu-latest.txt | 104 ++++++++++++++++++ .../windows-latest.txt | 104 ++++++++++++++++++ docs/compact-headers.md | 8 +- docs/playable-validation.md | 15 +++ 5 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 benchmarks/object-headers-2026-10-03/macos-26.txt create mode 100644 benchmarks/object-headers-2026-10-03/ubuntu-latest.txt create mode 100644 benchmarks/object-headers-2026-10-03/windows-latest.txt diff --git a/benchmarks/object-headers-2026-10-03/macos-26.txt b/benchmarks/object-headers-2026-10-03/macos-26.txt new file mode 100644 index 000000000..05395d957 --- /dev/null +++ b/benchmarks/object-headers-2026-10-03/macos-26.txt @@ -0,0 +1,104 @@ +Java openjdk 25.0.4.1 2026-08-18 LTS +Platform Darwin 25.6.0 arm64; logical CPUs 3 +fork=0 requested_compact_headers=False +compact_object_headers=false +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +fork=0 requested_compact_headers=True +compact_object_headers=true +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +fork=1 requested_compact_headers=False +compact_object_headers=false +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +fork=1 requested_compact_headers=True +compact_object_headers=true +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +fork=2 requested_compact_headers=False +compact_object_headers=false +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +fork=2 requested_compact_headers=True +compact_object_headers=true +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 diff --git a/benchmarks/object-headers-2026-10-03/ubuntu-latest.txt b/benchmarks/object-headers-2026-10-03/ubuntu-latest.txt new file mode 100644 index 000000000..e8b4bb484 --- /dev/null +++ b/benchmarks/object-headers-2026-10-03/ubuntu-latest.txt @@ -0,0 +1,104 @@ +Java openjdk 25.0.4.1 2026-08-18 LTS +Platform Linux 6.17.0-1022-azure x86_64; logical CPUs 4 +fork=0 requested_compact_headers=False +compact_object_headers=false +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +fork=0 requested_compact_headers=True +compact_object_headers=true +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +fork=1 requested_compact_headers=False +compact_object_headers=false +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +fork=1 requested_compact_headers=True +compact_object_headers=true +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +fork=2 requested_compact_headers=False +compact_object_headers=false +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +fork=2 requested_compact_headers=True +compact_object_headers=true +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 diff --git a/benchmarks/object-headers-2026-10-03/windows-latest.txt b/benchmarks/object-headers-2026-10-03/windows-latest.txt new file mode 100644 index 000000000..16ce4a844 --- /dev/null +++ b/benchmarks/object-headers-2026-10-03/windows-latest.txt @@ -0,0 +1,104 @@ +Java openjdk 25.0.4.1 2026-08-18 LTS +Platform Windows 2025Server AMD64; logical CPUs 4 +fork=0 requested_compact_headers=False +compact_object_headers=false +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +fork=0 requested_compact_headers=True +compact_object_headers=true +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +fork=1 requested_compact_headers=False +compact_object_headers=false +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +fork=1 requested_compact_headers=True +compact_object_headers=true +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +fork=2 requested_compact_headers=False +compact_object_headers=false +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=AABB objects=100000 allocated_bytes=6400000 bytes_per_object=64.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=Vec3 objects=100000 allocated_bytes=4000000 bytes_per_object=40.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +fork=2 requested_compact_headers=True +compact_object_headers=true +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=AABB objects=100000 allocated_bytes=5600000 bytes_per_object=56.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=Vec3 objects=100000 allocated_bytes=3200000 bytes_per_object=32.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=DhChunkPos objects=100000 allocated_bytes=2400000 bytes_per_object=24.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Long objects=100000 allocated_bytes=1600000 bytes_per_object=16.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 +type=Object objects=100000 allocated_bytes=800000 bytes_per_object=8.000 diff --git a/docs/compact-headers.md b/docs/compact-headers.md index 03b814a85..4261236df 100644 --- a/docs/compact-headers.md +++ b/docs/compact-headers.md @@ -40,7 +40,8 @@ volatile array, and their values are checked after measurement. The benchmark asserts that the running VM reports the requested flag. Output includes Java/OS/CPU architecture and goes to gitignored `dist/object-header-benchmark.txt`. -The local Linux x64 Java 25 measurements yielded: +Local Linux x64 and hosted Linux x64, Windows x64 and Apple Silicon macOS 26 +measurements yielded the same medians: | Type | Headers off, bytes/object | Headers on, bytes/object | | --- | ---: | ---: | @@ -50,6 +51,11 @@ The local Linux x64 Java 25 measurements yielded: | Boxed `Long`, outside cache | 24 | 16 | | Plain `Object` | 16 | 8 | +[Raw platform results](../benchmarks/object-headers-2026-10-03) come from +[CI run 37153955462](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37153955462). +Each platform has nine measured batches per type/mode across three JVM forks. +The hosted ARM Mac has three logical CPUs and is not the user's M2 Pro. + These are allocations for specific object layouts, not a measured reduction in whole-game retained heap, process RSS, FPS or server TPS. Changing headers can also change runtime tradeoffs. Real workloads and the user's M2 Pro remain the diff --git a/docs/playable-validation.md b/docs/playable-validation.md index fcaef5b72..78cffdfd7 100644 --- a/docs/playable-validation.md +++ b/docs/playable-validation.md @@ -22,6 +22,21 @@ Version 0.2.0 targets Minecraft 26.3 / Fabric 0.19.5 / Java 25. This is an initi ## Interpretation limits +The exact 0.8.0 JAR (SHA-256 +`b674be112cd148406b6b79c14f54b91a4da1ac0e03fe744aaee857c5a51eae8a`) +loaded the complete adaptive-queue stack with compact headers enabled. A fresh +options file retained custom graphics preset, render distance 12 and simulation +distance 12 in the actual frame report. The 120-second run produced 793 frame +intervals and 2,409 server-tick samples; CSV counts and mean durations match JSON. +Both reports captured compact headers as true, G1 collector names and 120 RSS +samples. The offline viewer displayed these actual settings, RSS and CSV charts; +general frame/tick, invalid-input, escaping and mobile checks also passed. +World/database shutdown completed cleanly. This software-rendered integration +test is not a matched RAM/FPS comparison. Cross-platform builds, native-reader +tests, metrics under compact headers, isolated allocation probes and 20 Python +tests passed on Linux, Windows and hosted Apple Silicon macOS 26. See +[object layouts and measurement limits](compact-headers.md). + Generated pack options now carry data version 5023, verified against `version.json` inside the checksum-verified Minecraft 26.3 JAR. Without this marker, the game's legacy-options migration reset the intended backend to Default. The fixed Vulkan