[PR #2998] [MERGED] perf(client): read the loot tables while joining a server #4749

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2998
Author: @feeldev12
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

Base: main ← Head: perf/server-loot-preload


📝 Commits (1)

  • fdefcfe perf(client): read the loot tables while joining a server

📊 Changes

2 files changed (+22 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+1 -0)
📝 crates/horizon-client/src/game/world_loading.rs (+21 -0)

📄 Description

What and why

On a server's world nothing reads the loot tables ahead of time: the world screens' preload (preload_world_data) only runs for Singleplayer and Create World, on purpose. So the first block a player places on a server builds the step context, loot_data reads every loot table on the game thread, and the game freezes. On a phone (Mali GPU, mid-range ARM) that freeze measured about 0.6 s.

preload_server_loot now reads them on a helper thread (behind_server, like the world preload) when connect_server_with_cookies starts the join, so the connection and the world's first chunks overlap it. It marks the preload Used, as open_world does, so the 60-second drop doesn't take the data back during play. It does nothing if the tables are already loaded.

This keeps the title screen and Multiplayer list free of the memory, as the world preload's comment intends. Only an actual join reads them.

Vanilla reference

Horizon-only. Vanilla's client never loads loot tables; Horizon's client uses them for its own step context.

Self-check

cargo fmt and cargo check -p horizon-client are clean. I didn't run the full pr_ready.py locally (it is slow on this machine); CI's verify covers it.


🔄 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/2998 **Author:** [@feeldev12](https://github.com/feeldev12) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/server-loot-preload` --- ### 📝 Commits (1) - [`fdefcfe`](https://github.com/horizon-rust/horizon/commit/fdefcfeac08905063174305a26aaed7368f409c2) perf(client): read the loot tables while joining a server ### 📊 Changes **2 files changed** (+22 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+1 -0) 📝 `crates/horizon-client/src/game/world_loading.rs` (+21 -0) </details> ### 📄 Description ## What and why On a server's world nothing reads the loot tables ahead of time: the world screens' preload (`preload_world_data`) only runs for Singleplayer and Create World, on purpose. So the first block a player places on a server builds the step context, `loot_data` reads every loot table on the game thread, and the game freezes. On a phone (Mali GPU, mid-range ARM) that freeze measured about 0.6 s. `preload_server_loot` now reads them on a helper thread (`behind_server`, like the world preload) when `connect_server_with_cookies` starts the join, so the connection and the world's first chunks overlap it. It marks the preload `Used`, as `open_world` does, so the 60-second drop doesn't take the data back during play. It does nothing if the tables are already loaded. This keeps the title screen and Multiplayer list free of the memory, as the world preload's comment intends. Only an actual join reads them. ## Vanilla reference Horizon-only. Vanilla's client never loads loot tables; Horizon's client uses them for its own step context. ## Self-check `cargo fmt` and `cargo check -p horizon-client` are clean. I didn't run the full `pr_ready.py` locally (it is slow on this machine); CI's `verify` covers it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:39 +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#4749
No description provided.