[PR #6436] [MERGED] Net replay bench: horizon-bots --capture and a net_replay example #6870

Closed
opened 2026-11-03 06:28:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6436
Author: @ludovic111
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: perf/net-replay-bench


📝 Commits (2)

  • af3a264 Net replay bench: horizon-bots --capture, net_replay example
  • 9784cf6 Merge remote-tracking branch 'origin/main' into perf/net-replay-bench

📊 Changes

2 files changed (+259 additions, -1 deletions)

View changed files

📝 crates/horizon-bots/src/main.rs (+54 -1)
➕ crates/horizon-protocol/examples/net_replay.rs (+205 -0)

📄 Description

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

What

A way to measure what the client's network side costs, on real traffic, without a game or a GPU:

  • horizon-bots --capture FILE records the first bot's play packets (milliseconds since it joined, id, body).
  • cargo run --release -p horizon-protocol --example net_replay -- FILE sends them through an in-memory connection three times (single player's pipe; a server's default compression threshold 256; the same encrypted, as online-mode servers send it), times ConnReader::recv for every packet, then play::Clientbound::decode per packet type and the chunk packets' section parsing.

Tooling only (skip-release).

First numbers (main, AMD EPYC 7662, one core)

Horizon dedicated server, RD 32 join, one idle bot: 3725 chunks, 116k packets, 167 MB of packet bodies, 30.2 MB on the wire.

stage ms per packet
recv, single player pipe 343-578 3.0-5.0 µs
recv, compressed 419-622 3.6-5.4 µs
recv, compressed + encrypted 8000-9470 69-82 µs
decode, all packets 42 chunk 7.8 µs
chunk sections 158 42 µs a chunk

Also captured: a vanilla 26.3 server (server.jar) at RD 32 (0 decode errors) and a Horizon server with 100 walking bots (waypoint 68k packets at 549 ns, move_entity_pos 63k).

Self-check

pr_ready (tools/pr_ready.py --quick on playhorizon, against origin/main at 2556a20c7, 6 min 45 s)

Check Result
Scope ✅ 2 files, +259 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 602 passed (1 min 10 s)
rustfmt ✅ (13 s)
clippy ✅ (4 min 19 s)
tests: horizon-bots, horizon-protocol ✅ 173 passed (59 s)
doc tests ✅ 0 passed
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 26 affected, to run in CI (--quick): armor_stand_frost, arrow_wind_charge, blending, block_tint, boat_authority, boat_paddle_reset, boat_submerged, dragon_render, enchantment_components, held_item_stack, inline_object, item_use_order and 14 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/6436 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/net-replay-bench` --- ### 📝 Commits (2) - [`af3a264`](https://github.com/horizon-rust/horizon/commit/af3a264af1d715918325a72c35835a006fd0cfea) Net replay bench: horizon-bots --capture, net_replay example - [`9784cf6`](https://github.com/horizon-rust/horizon/commit/9784cf63fdca3a67c7cc9708beedd9fcef199ff7) Merge remote-tracking branch 'origin/main' into perf/net-replay-bench ### 📊 Changes **2 files changed** (+259 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-bots/src/main.rs` (+54 -1) ➕ `crates/horizon-protocol/examples/net_replay.rs` (+205 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What A way to measure what the client's network side costs, on real traffic, without a game or a GPU: - `horizon-bots --capture FILE` records the first bot's play packets (milliseconds since it joined, id, body). - `cargo run --release -p horizon-protocol --example net_replay -- FILE` sends them through an in-memory connection three times (single player's pipe; a server's default compression threshold 256; the same encrypted, as online-mode servers send it), times `ConnReader::recv` for every packet, then `play::Clientbound::decode` per packet type and the chunk packets' section parsing. Tooling only (`skip-release`). ## First numbers (main, AMD EPYC 7662, one core) Horizon dedicated server, RD 32 join, one idle bot: 3725 chunks, 116k packets, 167 MB of packet bodies, 30.2 MB on the wire. | stage | ms | per packet | |---|---|---| | recv, single player pipe | 343-578 | 3.0-5.0 µs | | recv, compressed | 419-622 | 3.6-5.4 µs | | recv, compressed + encrypted | 8000-9470 | 69-82 µs | | decode, all packets | 42 | chunk 7.8 µs | | chunk sections | 158 | 42 µs a chunk | Also captured: a vanilla 26.3 server (`server.jar`) at RD 32 (0 decode errors) and a Horizon server with 100 walking bots (waypoint 68k packets at 549 ns, move_entity_pos 63k). ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on playhorizon, against origin/main at 2556a20c7, 6 min 45 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +259 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 602 passed (1 min 10 s) | | rustfmt | ✅ (13 s) | | clippy | ✅ (4 min 19 s) | | tests: horizon-bots, horizon-protocol | ✅ 173 passed (59 s) | | doc tests | ✅ 0 passed | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 26 affected, to run in CI (--quick): armor_stand_frost, arrow_wind_charge, blending, block_tint, boat_authority, boat_paddle_reset, boat_submerged, dragon_render, enchantment_components, held_item_stack, inline_object, item_use_order and 14 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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 06:28:25 +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#6870
No description provided.