From 753c071c3776229928508b5d7d6451644f4c8ec1 Mon Sep 17 00:00:00 2001 From: rdbtCVS <87152661+rdbtCVS@users.noreply.github.com> Date: Thu, 22 Oct 2026 15:09:08 +0100 Subject: [PATCH] docs: record early-stopped chunk optimization attempts --- docs/chunk-performance-campaign.md | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/chunk-performance-campaign.md b/docs/chunk-performance-campaign.md index 99645041e..5c9d15001 100644 --- a/docs/chunk-performance-campaign.md +++ b/docs/chunk-performance-campaign.md @@ -98,3 +98,45 @@ Correctness: all timed baseline/candidate compressed-record and block/biome/ligh The temporary `load_snapshot.rs` harness and true baseline/candidate binaries are archived under `palette/`; the harness was removed from the working tree. It hashes resident palette/word representations and light values, canonical complete reencoded NBT (including heightmaps/block entities), saved root NBT/block-entity sources/order/ticks, and loaded flags, names, postprocessing, entities and structure references. Every full chunk was checked: 400 normal and 289 flat, plus a synthetic nested unknown NBT key and nonempty block/fluid ticks for each corpus. All 691 per-case baseline/candidate outputs match byte-for-byte. `palette/correctness.json` records hashes; `palette/sources.json` authenticates both core sources and the harness. Exact candidate source was restored after the baseline comparison. Both baseline and candidate also ran `save_parity` against the pinned vanilla-generated worlds: 324 interior normal chunks have zero block, biome, heightmap or other metadata differences, with the same preexisting 7/63,700,992 recomputed light-value differences in both revisions. All checks on 225 interior flat chunks are identical to vanilla, including all 44,236,800 light values. This establishes no added discrepancy in these comparisons; it is not a clean normal-world lighting parity pass. The full server/client `test_save_roundtrip_parity.py` simulation was not run; the candidate changes only loading/validation, and the read-only full-output comparison covers unchanged save output. No generation parity claim or PR is included in this agent's result. + + +## Round 3: aquifer neighborhood pilot — rejected + +Inspected the pinned server 26.3 `Aquifer.NoiseBasedAquifer.computeSubstance` bytecode and current open PRs; no aquifer optimization overlap was found. Tested a single-current-grid cache of the 12 decoded candidate positions/indices, populated in vanilla cell order only after successful checked accesses, plus explicit four-slot nearest insertion preserving later-cell distance ties. The candidate touched only `worldgen/aquifer/noise_based.rs`; no noise evaluation or terrain traversal was changed. + +Evidence is retained in `/srv/bob-data/horizon-chunk-campaign-41055168/aquifer/`: baseline source, candidate patch, preserved candidate executable, binary hashes, build log, pilot script, all process logs, `pilot-raw.json` and `summary.json`. Pinned Java bytecode is in `aquifer-java-bytecode.txt` at the parent artifact root. The benchmark source SHA256 is `f404feb7ec526f12735d11b15af36254fd585f39b975cdbdc71905d87f10f8cc`, identical to the preserved `chunkgen_bench-profile` baseline source. Both executables use the established release flags and resources. No builds, tests or profilers ran during timing. + +One discarded process pair followed by three alternating pairs used the primary seed-12345, center-(0,0), size-16, one-worker warmed command. Every process generated 256 proto chunks and decorated 196 chunks. Complete proto+decoration paired reductions were **3.864%, 4.326%, 3.828%** (median **3.864%**); baseline/candidate complete-time medians were **2.678451 s / 2.568094 s**. This does not clear the 5% complete-workload gate. The pilot had already completed when the parent requested early cancellation. The production candidate was reverted; no qualification, four-worker/second-site matrix, parity tests, generated snapshots or PR were pursued. No correctness claim is made for the rejected candidate. This result applies to this mechanism and corpus, not an upper bound on all aquifer optimization. + +Next lead: remaining material-rule dispatch/data access (8.52% exclusive terrain-worker CPU), after checking the already-merged surface changes. Preserve rule evaluation order and random consumption; reject early if its complete-workload pilot remains below 5%. + + +## Round 4: remaining material-rule dispatch — early no-go + +Inspected merged #801 (`Specialize constant surface material-rule branches`), `docs/surface-generation-benchmark.md`, the current compiled rule/condition/density implementation, and the pinned 26.3 material resources and Java `ConditionRule`, `SequenceRule`, `OreVeinRule`, and `BlockRule` bytecode. The open-PR list was checked on 2026-10-22; no additional material-rule dispatch PR was found, and the campaign's excluded mechanisms were left untouched. Inspection evidence is retained under `/srv/bob-data/horizon-chunk-campaign-41055168/surface-feasibility/`: `pinned-material-bytecode.txt` and `inspection.json` (source commit, pinned server-game SHA256, and static expanded rule counts). + +The existing implementation already removes constant predicates and singleton/empty sequences after compiling all children, shares eager density roots, and uses unit-step material-volume indexing. The 8.52% exclusive terrain-worker sample share for `CompiledRule::apply` includes ore-vein execution and inlined work, so it cannot be treated as removable dispatch overhead. Vanilla's top-level Overworld sequence includes both ore-vein rules before the surface predicate and underground rules. Condition/block fusion or flattening nested sequences would remove only part of this work; a broad replacement evaluator would be a speculative refactor without evidence for the required complete-workload gain. The raw expanded Overworld resource tree contains 53 sequences, 149 conditions, 110 blocks, two ore-vein rules and two band rules; these static counts precede constant specialization and are not runtime frequencies. + +Decision: **early no-go**, accepted by the parent before implementation. No production source or tests were changed, no build/timing/parity jobs were run, and no candidate or PR was created. This is a feasibility rejection, not a measured performance result or an upper bound on future material optimizations. The rejected aquifer executable in the shared target directory was not used. Earlier campaign evidence and the uncommitted Round 3 report were preserved. + + +## Round 5: section access and construction — early no-go + +Inspected `BlockSection` get/set/construction, `PackedStorage` addressing, the existing ignored section microbenchmark and differential tests, and merged commits `939eabe6`, `56a251eb` and `5c55e7d8`. Checked the open-PR list on 2026-10-22; no section-storage optimization overlap was found. Pinned 26.3 `LevelChunkSection`, `PalettedContainer` and `SimpleBitStorage` bytecode was inspected before considering changes. Evidence is retained in `/srv/bob-data/horizon-chunk-campaign-41055168/section-feasibility/`: `pinned-section-bytecode.txt`, `baseline-access-assembly.txt` and `inspection.json` (source/pinned-jar/baseline hashes and the bounded open-PR catalog). + +The current implementation already reads the old packed index directly, resolves the incoming state with one multiplicative-hash map probe, reuses freed palette slots, and skips repeated storage validation after the section checks. The ignored microbenchmark compares against older pre-optimization implementations; its historical speedups are already in the campaign baseline and cannot qualify a new candidate. Uniform construction still allocates palette/count/map storage, but construction is not identified as a substantial exclusive hotspot in the retained profile. + +The preserved baseline executable confirms runtime division in packed-index addressing; pinned Java uses reciprocal multiplication in `SimpleBitStorage.cellIndex`. This is a possible future storage investigation, but the division is only part of the sampled access cost, alongside palette/word loads, incoming-state lookup and count/free-slot handling. Terrain samples assign 6.09% exclusive CPU to `set` and 2.79% to `get`, while the separate decoration sample assigns 9.95% to `get`; these site-specific shares are not a measured removable fraction or a complete-workload speedup prediction. There is no evidence here that a small addressing or construction change can remove enough complete proto-plus-decoration work to meet the 5% gate. A dense representation or bulk terrain writer would need broader semantic and workload evidence and was not attempted. + +Decision: **early no-go**, accepted by the parent before implementation. No production source or tests were changed, no build/timing/parity jobs were run, and no candidate or PR was created. No new correctness or performance result is claimed. The rejected aquifer executable in the shared target directory was not used; assembly inspection used the preserved genuine baseline. Earlier campaign evidence and uncommitted Round 3/4 reports were preserved. + + +## Round 6: saved block-state cache keys — rejected + +Inspected the loader's formatted per-chunk state-cache keys, `BlockState::from_nbt`, registry lookup/default fallback, and pinned 26.3 `StateHolder.codec`/`BlockState` bytecode. Checked the open-PR list on 2026-10-22; no saved-state-cache optimization overlap was found. The candidate derived `Hash` for `BlockState` and replaced the formatted string key with the parsed structural state. Invalid parse results returned air directly; the existing registry/default-property resolution was retained. No palette or lighting code changed. + +Evidence is retained under `/srv/bob-data/horizon-chunk-campaign-41055168/state-key/`: candidate patch and sources, preserved baseline source copies, pinned bytecode, bounded open-PR catalog, build log, paired runner, raw process observations/logs, executable hashes and summary. The baseline was the preserved **accepted palette candidate**, so these results are incremental to commit `5d82b4c9`, with none of its earlier gain counted again. Both binaries used identical `load_bench` source (SHA256 `b6f5042731d7c9d5622758043f7c1e125a3f7d098c57ee0501012474c2df7325`), release/thin-LTO/one-codegen-unit flags, resources and normal corpus. No builds, tests or profilers overlapped timing. + +One discarded process pair followed by two alternating measured pairs used `--rounds 5 --limit 256 --checksum`. Complete normal-load paired reductions were **3.257% and 2.412%** (median **2.835%**); baseline/candidate process-median medians were **49.725 / 48.316 ms** per 256 chunks. Native decode improved **5.917%** (20.266 / 19.067 ms); inflate/NBT varied by **-0.844%**. Compressed-record and block/biome/light checksums matched in every process. Those checksums are limited benchmark checks, not comprehensive semantic or vanilla parity evidence. + +Decision: **early no-go** at the incremental 5% complete-load gate. Both production files were restored exactly to their pre-candidate contents; only this report remains. No flat/long qualification, comprehensive snapshot comparison, fresh parity suite, tests, commit or PR were pursued for this rejected candidate. The shared Cargo target contains the rejected executable; future work must use the preserved accepted binary or rebuild restored sources.