[PR #524] [MERGED] Data packs: walk only the folders functions, tags and predicates live in #2624

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

📋 Pull Request Information

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

Base: main ← Head: perf/datapack-walk


📝 Commits (1)

  • 0981e0a Data packs: walk only the folders functions, tags and predicates live in

📊 Changes

1 file changed (+62 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/datapack.rs (+62 -1)

📄 Description

What

Every world load runs DataStore::load (functions, function tags, predicates, item modifiers) on the render thread. To find those files it listed every file under each folder pack's data/, including the built-in pack: 9,884 files, of which only a handful are of those four kinds. A folder pack now walks data/<namespace>/<kind>/ for the four kinds only. The list it gives is the old list filtered to those kinds, in the same order, so the store comes out the same (the errors logged for broken functions keep their order too). Zip packs keep filtering their index, which costs nothing.

Why

#489: perf-cores-1 measured this walk at 148 ms of the one-off work on the render thread while a world opens.

Results

Built-in pack (.local/horizon-client/26.3, 9,884 data files), release build, 3 rounds on the Mac mini M4 Pro with other sessions running:

main (list("data/")) this PR (list_kinds)
Listing the files 192 / 228 / 337 ms 0.14 / 0.51 / 0.16 ms
Files listed 9,884 3 (the three vanilla predicates)
DataStore::load, whole (the listing plus reads) 0.17 to 0.45 ms

In each round a temporary test checked that the new list equals the old list filtered to the four kinds.

How tested

  • New unit test folder_packs_list_the_needed_kinds_in_walk_order: a pack with the four kinds across three namespaces, plus other kinds (loot_table, tags/block, recipe, worldgen) and the old functions/ name. list_kinds gives exactly the old list("data/") filtered to the wanted kinds, in the same order.
  • packs_provide_functions_and_tags (functions, nested tags, predicates from a folder pack) still passes.

Self-check

  • cargo fmt --all --check: clean.
  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test -p horizon-client --lib: 753 passed, 0 failed.
  • Local parity, tools/parity.py --changed origin/main (4 at a time on a loaded Mac mini): 84 harnesses affected, 83 passed. world_spawn did not finish twice, for reasons outside this change: the first time the Horizon server could not bind its port (another server on the machine held it), the second time the run was killed from outside while the last seed's server was still loading. In that second run 59 of 60 seeds matched vanilla; the last one (6175507065363340566) and two fixed seeds then matched when run alone (tools/test_world_spawn_parity.py --seed ...). So all 60 seeds match.

Nothing needs Ludovic.

🤖 Generated with Claude Code


🔄 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/524 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/datapack-walk` --- ### 📝 Commits (1) - [`0981e0a`](https://github.com/horizon-rust/horizon/commit/0981e0abcfc4da9a32aa42900bc38321c0c8ba62) Data packs: walk only the folders functions, tags and predicates live in ### 📊 Changes **1 file changed** (+62 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/datapack.rs` (+62 -1) </details> ### 📄 Description ## What Every world load runs `DataStore::load` (functions, function tags, predicates, item modifiers) on the render thread. To find those files it listed every file under each folder pack's `data/`, including the built-in pack: 9,884 files, of which only a handful are of those four kinds. A folder pack now walks `data/<namespace>/<kind>/` for the four kinds only. The list it gives is the old list filtered to those kinds, in the same order, so the store comes out the same (the errors logged for broken functions keep their order too). Zip packs keep filtering their index, which costs nothing. ## Why #489: perf-cores-1 measured this walk at 148 ms of the one-off work on the render thread while a world opens. ## Results Built-in pack (`.local/horizon-client/26.3`, 9,884 data files), release build, 3 rounds on the Mac mini M4 Pro with other sessions running: | | `main` (`list("data/")`) | this PR (`list_kinds`) | | --- | --- | --- | | Listing the files | 192 / 228 / 337 ms | 0.14 / 0.51 / 0.16 ms | | Files listed | 9,884 | 3 (the three vanilla predicates) | | `DataStore::load`, whole | (the listing plus reads) | 0.17 to 0.45 ms | In each round a temporary test checked that the new list equals the old list filtered to the four kinds. ## How tested - New unit test `folder_packs_list_the_needed_kinds_in_walk_order`: a pack with the four kinds across three namespaces, plus other kinds (`loot_table`, `tags/block`, `recipe`, `worldgen`) and the old `functions/` name. `list_kinds` gives exactly the old `list("data/")` filtered to the wanted kinds, in the same order. - `packs_provide_functions_and_tags` (functions, nested tags, predicates from a folder pack) still passes. ### Self-check - `cargo fmt --all --check`: clean. - `cargo clippy --workspace --all-targets -- -D warnings`: clean. - `cargo test -p horizon-client --lib`: 753 passed, 0 failed. - Local parity, `tools/parity.py --changed origin/main` (4 at a time on a loaded Mac mini): **84 harnesses affected, 83 passed.** `world_spawn` did not finish twice, for reasons outside this change: the first time the Horizon server could not bind its port (another server on the machine held it), the second time the run was killed from outside while the last seed's server was still loading. In that second run 59 of 60 seeds matched vanilla; the last one (6175507065363340566) and two fixed seeds then matched when run alone (`tools/test_world_spawn_parity.py --seed ...`). So all 60 seeds match. Nothing needs Ludovic. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:57:43 +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#2624
No description provided.