[PR #220] [MERGED] perf: reuse unchanged resource-pack overlays after validation #2415

Closed
opened 2026-11-02 15:55:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/220
Author: @rdbtCVS
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @ludovic111

Base: main ← Head: perf/reuse-pack-overlays-20261014


📝 Commits (3)

  • 8177726 perf: reuse validated resource-pack overlays
  • 1295fcc perf(client): validate overlay reuse with source stamps and benchmark real packs
  • cc8744a Trim synthetic overlay benchmarks; record Mac real-pack numbers

📊 Changes

6 files changed (+1027 additions, -1 deletions)

View changed files

📝 Cargo.lock (+3 -0)
➕ benchmarks/overlay-real-packs-2026-10-15.json (+54 -0)
📝 crates/horizon-client/Cargo.toml (+2 -0)
📝 crates/horizon-client/src/packs.rs (+29 -1)
➕ crates/horizon-client/src/packs/cache.rs (+893 -0)
➕ docs/reuse-pack-overlays.md (+46 -0)

📄 Description

Repeated resource-pack startup now reuses a completed overlay using source stamps and a validity marker. Unix cache hits no longer hash ZIP bytes or walk the generated output tree. The unchanged real-pack path takes 0.3–0.7 ms; rebuilding stays close to the original cost.

Changes responding to review

  • Validate ZIP/materialized inputs with len, mtime, device/inode and change time on Unix. Preserve content validation on non-Unix platforms without a portable change timestamp.
  • Trust published output as an owned cache artifact. Missing/corrupt markers or an absent output root rebuild; clearing the marker repairs externally modified output files.
  • Preserve original relative symlink targets in the builder. Only marker identity resolves paths; root aliases, pack order, overlays and filters retain their behavior.
  • Keep persistent OS locking, failed-build marker removal, stable input checks, and publication only after successful rebuilding.

Prepared 26.3 and real ZIP packs

The benchmark calls the actual production resource_root path and reproduces its original selection/key/builder sequence. Identical prepared Minecraft 26.3 resources (schema 7), two warmups, 11 alternating samples, warmed filesystem caches; full output bytes and symlink identities verified outside timing. Ryzen 5 5600X, Linux x86_64/ext4/NVMe, Rust 1.99.0, Cargo fast.

Pack Original rebuild Cached cold Unchanged hit Saved per hit
Faithful 32x 26.3 159.827 ms 162.711 ms 0.707 ms 159.120 ms
Default HD 128x demo 1.8.2.7 111.501 ms 114.386 ms 0.310 ms 111.191 ms
FPBR 128x 1.21.9 R1.3 347.639 ms 348.012 ms 0.448 ms 347.191 ms

These ZIP cache hits improve roughly 226–775×, with 0.1–2.6% cold overhead. Packs were downloaded from publisher releases and checked against their SHA-512 hashes; version URLs, file hashes/sizes and the prepared manifest identity are committed in benchmarks/overlay-real-packs-2026-10-15.json. FPBR targets older snapshots: this measures overlay assembly over prepared 26.3 resources, without asserting visual/version compatibility. Default HD is the free demo. No overall startup/FPS claim; scanning and texture decoding are excluded.

The synthetic directory fixture still incurs about 17% cold overhead (108.487→126.438 ms), while unchanged reuse takes 7.438 ms (14.6× faster). Its ZIP variant is 155.540→0.128 ms, with cold 155.453 ms. A four-file directory adds about 0.16 ms cold. Directory topology validation remains necessary.

Validation

  • 13 focused tests pass: sources/config/order, merged inputs, Unix preserved-mtime rewrites, live links/root aliases, vanilla membership, explicit output recovery, failed ZIPs, normalized/external overlays, symlink cycles, concurrency and relative targets.
  • All three ignored benchmarks pass with output-equivalence checks.
  • Client lib/tests Clippy with -D warnings, formatting and diff checks pass.

Non-Unix behavior was not runtime-tested; it retains file content hashing. Generated output is trusted rather than checked for manual edits. Each overlay retains a small JSON marker and persistent lock file. Commands, source links and measurement limits: docs/reuse-pack-overlays.md.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/220 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/reuse-pack-overlays-20261014` --- ### 📝 Commits (3) - [`8177726`](https://github.com/horizon-rust/horizon/commit/8177726f70d57e1a3485c5db582d1b8a83435c42) perf: reuse validated resource-pack overlays - [`1295fcc`](https://github.com/horizon-rust/horizon/commit/1295fccd17d4bab9e95b320085f78373701d9482) perf(client): validate overlay reuse with source stamps and benchmark real packs - [`cc8744a`](https://github.com/horizon-rust/horizon/commit/cc8744a06bbbdd46ea5378e45dba9c2499165de8) Trim synthetic overlay benchmarks; record Mac real-pack numbers ### 📊 Changes **6 files changed** (+1027 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+3 -0) ➕ `benchmarks/overlay-real-packs-2026-10-15.json` (+54 -0) 📝 `crates/horizon-client/Cargo.toml` (+2 -0) 📝 `crates/horizon-client/src/packs.rs` (+29 -1) ➕ `crates/horizon-client/src/packs/cache.rs` (+893 -0) ➕ `docs/reuse-pack-overlays.md` (+46 -0) </details> ### 📄 Description Repeated resource-pack startup now reuses a completed overlay using source stamps and a validity marker. Unix cache hits no longer hash ZIP bytes or walk the generated output tree. The unchanged real-pack path takes 0.3–0.7 ms; rebuilding stays close to the original cost. ### Changes responding to review - Validate ZIP/materialized inputs with len, mtime, device/inode and change time on Unix. Preserve content validation on non-Unix platforms without a portable change timestamp. - Trust published output as an owned cache artifact. Missing/corrupt markers or an absent output root rebuild; clearing the marker repairs externally modified output files. - Preserve original relative symlink targets in the builder. Only marker identity resolves paths; root aliases, pack order, overlays and filters retain their behavior. - Keep persistent OS locking, failed-build marker removal, stable input checks, and publication only after successful rebuilding. ### Prepared 26.3 and real ZIP packs The benchmark calls the actual production `resource_root` path and reproduces its original selection/key/builder sequence. Identical prepared Minecraft 26.3 resources (schema 7), two warmups, 11 alternating samples, warmed filesystem caches; full output bytes and symlink identities verified outside timing. Ryzen 5 5600X, Linux x86_64/ext4/NVMe, Rust 1.99.0, Cargo `fast`. | Pack | Original rebuild | Cached cold | Unchanged hit | Saved per hit | | --- | ---: | ---: | ---: | ---: | | Faithful 32x 26.3 | 159.827 ms | 162.711 ms | 0.707 ms | 159.120 ms | | Default HD 128x demo 1.8.2.7 | 111.501 ms | 114.386 ms | 0.310 ms | 111.191 ms | | FPBR 128x 1.21.9 R1.3 | 347.639 ms | 348.012 ms | 0.448 ms | 347.191 ms | These ZIP cache hits improve roughly 226–775×, with 0.1–2.6% cold overhead. Packs were downloaded from publisher releases and checked against their SHA-512 hashes; version URLs, file hashes/sizes and the prepared manifest identity are committed in `benchmarks/overlay-real-packs-2026-10-15.json`. FPBR targets older snapshots: this measures overlay assembly over prepared 26.3 resources, without asserting visual/version compatibility. Default HD is the free demo. No overall startup/FPS claim; scanning and texture decoding are excluded. The synthetic directory fixture still incurs about 17% cold overhead (108.487→126.438 ms), while unchanged reuse takes 7.438 ms (14.6× faster). Its ZIP variant is 155.540→0.128 ms, with cold 155.453 ms. A four-file directory adds about 0.16 ms cold. Directory topology validation remains necessary. ### Validation - 13 focused tests pass: sources/config/order, merged inputs, Unix preserved-mtime rewrites, live links/root aliases, vanilla membership, explicit output recovery, failed ZIPs, normalized/external overlays, symlink cycles, concurrency and relative targets. - All three ignored benchmarks pass with output-equivalence checks. - Client lib/tests Clippy with `-D warnings`, formatting and diff checks pass. Non-Unix behavior was not runtime-tested; it retains file content hashing. Generated output is trusted rather than checked for manual edits. Each overlay retains a small JSON marker and persistent lock file. Commands, source links and measurement limits: `docs/reuse-pack-overlays.md`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:55:52 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2415
No description provided.