[PR #5055] [MERGED] Packs: don't hash a large zip's bytes on every overlay check #6029

Closed
opened 2026-11-03 05:16:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5055
Author: @Teiwazik
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/pack-signature-reads-directory


📝 Commits (2)

  • 095342d Zip: read the directory on open, not the whole archive
  • 5994eb0 Packs: don't hash a large zip's bytes on every overlay check

📊 Changes

2 files changed (+230 additions, -29 deletions)

View changed files

📝 crates/horizon-client-render/src/packs/cache.rs (+51 -2)
📝 crates/horizon-client-render/src/zip.rs (+179 -27)

📄 Description

🤖 Opened by Teiwazik's AI agent (Claude Code, Claude Opus 5.5), not by Teiwazik personally.

Closes #5054

Stacked on #5045, which adds the lazy Zip::open this uses. Until that merges, the diff here includes its commit; only the top commit is new.

What changes

The overlay's cache key hashed each enabled zip in full on every check. A zip over 250 MiB, vanilla's limit on a server pack, is now keyed by its length, modified time and central directory.

Zips up to that size keep the byte hash, so:

  • a server pack whose time is touched on join still doesn't rebuild the overlay, which is why the key avoided the stamp;
  • an edit is still seen when a zip's checksums don't show it. Nothing here checks them, and a pack can leave them empty. I hit this with the test archive, whose CRCs are zero, so the directory alone isn't enough.

A zip that doesn't open is hashed by its bytes, as before.

The tradeoff

For a zip over the limit, an edit that keeps its length, time and directory goes unnoticed, leaving a stale overlay. Copying a large pack over itself with a new time rebuilds the overlay once, even if nothing changed.

Measured

Windows, a 9 GB pack enabled, overlay already cached, launching into a world.

Launch Read from disk Resources loaded
#5045 alone (1 run) 11,950 MB 50 s
This PR (3 runs) 2,801 MB 32–33 s

That pack doesn't fit the atlas, so these runs end in the fallback to the default resources: they cover reading up to that point, not a full load of the pack. The first launch after this change rebuilds the overlay once because the key changed (75 s here, 10 GB written).

Testing

a_large_zip_is_stamped_by_its_directory_and_time covers both sides of the limit: which changes alter the key above it, and that the bytes still count below it.

pr_ready (tools/pr_ready.py --quick on Teiwazik, against origin/main at 9d979caa4, 4 min 48 s)

Check Result
Scope ✅ 2 files, +230 −29
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (1 min 17 s)
rustfmt ✅ (16 s)
clippy ✅ (1 min 31 s)
tests: horizon-client-render ✅ 709 passed (1 min 38 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses

🤖 Generated with Claude Code

https://claude.ai/code/session_01EBqm1v5zTsDGwuZF6XKFjL


🔄 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/5055 **Author:** [@Teiwazik](https://github.com/Teiwazik) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/pack-signature-reads-directory` --- ### 📝 Commits (2) - [`095342d`](https://github.com/horizon-rust/horizon/commit/095342d9b728fc6a5a84f1167fb1244a82fbbc22) Zip: read the directory on open, not the whole archive - [`5994eb0`](https://github.com/horizon-rust/horizon/commit/5994eb0aa4e20a4a4a8b53f858a627ebedc30024) Packs: don't hash a large zip's bytes on every overlay check ### 📊 Changes **2 files changed** (+230 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/packs/cache.rs` (+51 -2) 📝 `crates/horizon-client-render/src/zip.rs` (+179 -27) </details> ### 📄 Description > 🤖 Opened by Teiwazik's AI agent (Claude Code, Claude Opus 5.5), not by Teiwazik personally. Closes #5054 **Stacked on #5045**, which adds the lazy `Zip::open` this uses. Until that merges, the diff here includes its commit; only the top commit is new. ## What changes The overlay's cache key hashed each enabled zip in full on every check. A zip over 250 MiB, vanilla's limit on a server pack, is now keyed by its length, modified time and central directory. Zips up to that size keep the byte hash, so: - a server pack whose time is touched on join still doesn't rebuild the overlay, which is why the key avoided the stamp; - an edit is still seen when a zip's checksums don't show it. Nothing here checks them, and a pack can leave them empty. I hit this with the test archive, whose CRCs are zero, so the directory alone isn't enough. A zip that doesn't open is hashed by its bytes, as before. ## The tradeoff For a zip over the limit, an edit that keeps its length, time and directory goes unnoticed, leaving a stale overlay. Copying a large pack over itself with a new time rebuilds the overlay once, even if nothing changed. ## Measured Windows, a 9 GB pack enabled, overlay already cached, launching into a world. | Launch | Read from disk | Resources loaded | | --- | --- | --- | | #5045 alone (1 run) | 11,950 MB | 50 s | | This PR (3 runs) | 2,801 MB | 32–33 s | That pack doesn't fit the atlas, so these runs end in the fallback to the default resources: they cover reading up to that point, not a full load of the pack. The first launch after this change rebuilds the overlay once because the key changed (75 s here, 10 GB written). ## Testing `a_large_zip_is_stamped_by_its_directory_and_time` covers both sides of the limit: which changes alter the key above it, and that the bytes still count below it. **pr_ready** (`tools/pr_ready.py --quick` on Teiwazik, against origin/main at 9d979caa4, 4 min 48 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +230 −29 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (1 min 17 s) | | rustfmt | ✅ (16 s) | | clippy | ✅ (1 min 31 s) | | tests: horizon-client-render | ✅ 709 passed (1 min 38 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EBqm1v5zTsDGwuZF6XKFjL --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:44 +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#6029
No description provided.