From 1ac9c72ea31e6110386ee97b24a78d6291ed24cc Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 17 Oct 2026 13:15:36 +0200 Subject: [PATCH] Server: Fx hashing for each player's sent chunks and tracked entities The hub tests every player's sent-chunk set for every entity and every column of the view each tick, and each player's tracked-entity map for every entity: tens of thousands of SipHash lookups a tick with 50 players. Both now use the Fx hash. Their iteration order was random before and carries no meaning. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/lan/entity.rs | 2 +- crates/horizon-client/src/lan/guest.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/horizon-client/src/lan/entity.rs b/crates/horizon-client/src/lan/entity.rs index 3b926b372..0f82ea60c 100644 --- a/crates/horizon-client/src/lan/entity.rs +++ b/crates/horizon-client/src/lan/entity.rs @@ -58,7 +58,7 @@ struct Sent { #[derive(Default)] pub struct Tracker { - sent: std::collections::HashMap, + sent: crate::fast_hash::FxHashMap, } /// VecDeltaCodec.encode. diff --git a/crates/horizon-client/src/lan/guest.rs b/crates/horizon-client/src/lan/guest.rs index db426ca21..720cb53d6 100644 --- a/crates/horizon-client/src/lan/guest.rs +++ b/crates/horizon-client/src/lan/guest.rs @@ -8,7 +8,7 @@ use horizon_protocol::{ packets::{configuration::ClientInformation, play}, }; use std::{ - collections::{HashSet, VecDeque}, + collections::VecDeque, sync::{Arc, atomic::AtomicI32}, }; @@ -77,7 +77,7 @@ pub struct Guest { pub loaded: bool, // Chunks. pub center: Option<(i32, i32)>, - pub sent_chunks: HashSet<(i32, i32)>, + pub sent_chunks: crate::fast_hash::FxHashSet<(i32, i32)>, pub chunk_queue: Vec<(i32, i32)>, pub unacknowledged: u32, pub chunks_per_tick: f32, @@ -189,7 +189,7 @@ impl Guest { teleport_counter: 0, loaded: false, center: None, - sent_chunks: HashSet::new(), + sent_chunks: Default::default(), chunk_queue: Vec::new(), unacknowledged: 0, chunks_per_tick: 9.0,