[PR #1444] [MERGED] parity: run world_spawn in four shards #3527

Closed
opened 2026-11-03 04:10:11 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/parity-shard-world-spawn


📝 Commits (1)

  • c9c5362 parity: run world_spawn in four shards

📊 Changes

3 files changed (+33 additions, -14 deletions)

View changed files

➕ tools/parity_shard.py (+21 -0)
📝 tools/test_datafix_parity.py (+3 -11)
📝 tools/test_world_spawn_parity.py (+9 -3)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

world_spawn runs as four parity entries (PARITY_SHARDS = 4). Each entry creates the worlds of every fourth seed, in its own build directory. The shard helper datafix had moves to tools/parity_shard.py, and both harnesses use it.

Why

Workstream 1 of the review plan (review-1-ci, item 2: shard the long harnesses).

world_spawn starts a vanilla server and a Horizon server for each of its 60 seeds, one at a time. That is the CI job's longest harness:

  • 1,548, 1,531, 1,521, 1,332, 1,301 and 890 s in the last six parity runs;
  • 1,464 s in the runner's current state.

When a PR's changes reach it, the parity job can't finish sooner than that. In the 25-harness run (#39928202278) the harnesses took 22.7 min, of which world_spawn alone was 21.7.

The scheduler already starts the longest harness first (run() sorts by recorded seconds), so only splitting world_spawn shortens that floor.

Why only world_spawn

The other long harnesses in those logs (tab_list, entity_death_loot, locator_bar, save_roundtrip, menu_click) spend most of their time in their own cargo build. That is the rebuild #1443 removes. For example, entity_death_loot spent 14 min of its 14 min 7 s compiling, and tab_list spent 16.6 min in its cargo run steps. Splitting them would multiply that compile work. Once #1443 is in, any that still take over 5 minutes can get PARITY_SHARDS the same way.

parity_shard.py stays out of lab.py on purpose. Every harness imports lab.py, so a change there reruns all 329 in CI. This module reruns only datafix and world_spawn.

Numbers

Mac mini, probes prebuilt, same machine and load, --jobs 1 per run (the runner's default):

wall seeds
before: one run 782 s 60/60 match
after: 4 shards at once 394 s (387–390 s each) 15/15 match in each
  • CI (run 39954706631, Mac mini runner): the four shards took 457–469 s each, in parallel. The whole parity job (10 harnesses, with datafix's six shards) took 12.9 min. The last unsharded CI run with world_spawn took 1,436 s for it alone (run 39950216048).
  • The 60 per-seed results (vanilla and Horizon spawn, origin chunk) are identical between the two runs: sorted and diffed, ignoring the per-seed seconds.
  • The speedup is about 2x, not 4x: each seed starts two servers that generate chunks on several threads, so four at a time share the CPU. The tail drops from ~25 min to ~10–13 min on the loaded runner. In a large run the shards fill slots that other harnesses would otherwise use.

How tested

  • The before/after runs above: test_world_spawn_parity.py unsharded, then PARITY_SHARD=i/4 for i = 1..4 at once.
  • PARITY_SHARD=2/4 ... --random 6 --origins-only on the final code (the helper in its own module): 4/4 seeds, written to .local/world-spawn-parity/2-4.
  • datafix only moved its helper (same code). Its six shards rerun in this PR's CI.

Nothing here 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/1444 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/parity-shard-world-spawn` --- ### 📝 Commits (1) - [`c9c5362`](https://github.com/horizon-rust/horizon/commit/c9c53629d4d52398305a73fddb0d6ed0d66f9ea9) parity: run world_spawn in four shards ### 📊 Changes **3 files changed** (+33 additions, -14 deletions) <details> <summary>View changed files</summary> ➕ `tools/parity_shard.py` (+21 -0) 📝 `tools/test_datafix_parity.py` (+3 -11) 📝 `tools/test_world_spawn_parity.py` (+9 -3) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `world_spawn` runs as four parity entries (`PARITY_SHARDS = 4`). Each entry creates the worlds of every fourth seed, in its own build directory. The shard helper `datafix` had moves to `tools/parity_shard.py`, and both harnesses use it. ## Why Workstream 1 of the review plan (review-1-ci, item 2: shard the long harnesses). `world_spawn` starts a vanilla server and a Horizon server for each of its 60 seeds, one at a time. That is the CI job's longest harness: - 1,548, 1,531, 1,521, 1,332, 1,301 and 890 s in the last six parity runs; - 1,464 s in the runner's current state. When a PR's changes reach it, the parity job can't finish sooner than that. In the 25-harness run (#39928202278) the harnesses took 22.7 min, of which world_spawn alone was 21.7. The scheduler already starts the longest harness first (`run()` sorts by recorded seconds), so only splitting world_spawn shortens that floor. ### Why only world_spawn The other long harnesses in those logs (tab_list, entity_death_loot, locator_bar, save_roundtrip, menu_click) spend most of their time in their own `cargo build`. That is the rebuild #1443 removes. For example, entity_death_loot spent 14 min of its 14 min 7 s compiling, and tab_list spent 16.6 min in its `cargo run` steps. Splitting them would multiply that compile work. Once #1443 is in, any that still take over 5 minutes can get `PARITY_SHARDS` the same way. `parity_shard.py` stays out of `lab.py` on purpose. Every harness imports `lab.py`, so a change there reruns all 329 in CI. This module reruns only datafix and world_spawn. ## Numbers Mac mini, probes prebuilt, same machine and load, `--jobs` 1 per run (the runner's default): | | wall | seeds | |---|---|---| | before: one run | **782 s** | 60/60 match | | after: 4 shards at once | **394 s** (387–390 s each) | 15/15 match in each | - **CI (run 39954706631, Mac mini runner):** the four shards took 457–469 s each, in parallel. The whole parity job (10 harnesses, with datafix's six shards) took 12.9 min. The last unsharded CI run with world_spawn took 1,436 s for it alone (run 39950216048). - The 60 per-seed results (vanilla and Horizon spawn, origin chunk) are identical between the two runs: sorted and diffed, ignoring the per-seed seconds. - The speedup is about 2x, not 4x: each seed starts two servers that generate chunks on several threads, so four at a time share the CPU. The tail drops from ~25 min to ~10–13 min on the loaded runner. In a large run the shards fill slots that other harnesses would otherwise use. ## How tested - The before/after runs above: `test_world_spawn_parity.py` unsharded, then `PARITY_SHARD=i/4` for i = 1..4 at once. - `PARITY_SHARD=2/4 ... --random 6 --origins-only` on the final code (the helper in its own module): 4/4 seeds, written to `.local/world-spawn-parity/2-4`. - datafix only moved its helper (same code). Its six shards rerun in this PR's CI. Nothing here 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-03 04:10:11 +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#3527
No description provided.