From b718bef55592c2e9eb2e8e5b96afa9bb806c329e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 3 Oct 2026 21:17:49 +0200 Subject: [PATCH] Lengthen worker measurements to reduce CPU counter quantization --- docs/worker-pacing.md | 7 ++++++- tools/build_mod.py | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/worker-pacing.md b/docs/worker-pacing.md index 955ef74ee..d972d5855 100644 --- a/docs/worker-pacing.md +++ b/docs/worker-pacing.md @@ -46,13 +46,18 @@ python3 tools/build_mod.py --benchmark-workers ``` `dist/worker-pacing-benchmark.txt` records three runs per mode and requested budget, -using 2,000 jobs with a nominal ten-microsecond workload after warm-up. It compares +using 50,000 jobs with a nominal ten-microsecond workload after warm-up. It compares the actual upstream executor with a subclass using the original pacing routine. Worker CPU time and allocation counters exclude allocations on the producer thread. This is a timer/allocation microbenchmark, not Minecraft FPS, player TPS or a full terrain generation benchmark. Hosted Linux, macOS and Windows runs produce their own artifacts; contention and warm-up can change the results. +The first 2,000-job Windows runs exposed CPU-counter quantization: a single worker +could appear above one core or at zero CPU during a very short interval. Those +figures are not reliable CPU-duty results. The longer workload provides a larger +measurement window; counters and scheduling still have finite precision. + Deterministic tests simulate multiple job sizes, timer overshoot, configuration changes, idle time and invalid ratios. Native game validation must also check terrain progress, frame/tick capture and clean shutdown. On the M2 Pro, compare balanced, diff --git a/tools/build_mod.py b/tools/build_mod.py index b35deef37..ac4f3a7c7 100644 --- a/tools/build_mod.py +++ b/tools/build_mod.py @@ -108,7 +108,7 @@ def benchmark_workers(): for ratio in ["0.5", "0.05"]: for mode in ["upstream", "precise"]: subprocess.run(["java", "-cp", os.pathsep.join([str(tests), classpath]), - "dev.horizonlab.budget.WorkerPacingBenchmark", ratio, "10000", "2000", mode], + "dev.horizonlab.budget.WorkerPacingBenchmark", ratio, "10000", "50000", mode], stdout=report, check=True) print(output.read_text(), end="") @@ -118,6 +118,8 @@ if __name__ == "__main__": 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") args = parser.parse_args() + if args.test_only and args.benchmark_workers: + parser.error("--benchmark-workers requires the compiled mod; omit --test-only") test_metrics() if not args.test_only: build()