Merge pull request #8 from ludovic111/compact-header-measurements
Preserve fresh render budgets and measure compact Java headers
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,73 @@
|
||||
# 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`.
|
||||
|
||||
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 |
|
||||
| --- | ---: | ---: |
|
||||
| Minecraft `AABB` | 64 | 56 |
|
||||
| Minecraft `Vec3` | 40 | 32 |
|
||||
| Distant Horizons `DhChunkPos` | 24 | 24 |
|
||||
| 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
|
||||
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.
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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": [
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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){
|
||||
|
||||
+31
-2
@@ -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()
|
||||
|
||||
+1
-1
@@ -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"))}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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.")
|
||||
|
||||
+3
-1
@@ -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",
|
||||
|
||||
+3
-1
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user