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 <noreply@anthropic.com>
This commit is contained in:
@@ -58,7 +58,7 @@ struct Sent {
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Tracker {
|
||||
sent: std::collections::HashMap<i32, Sent>,
|
||||
sent: crate::fast_hash::FxHashMap<i32, Sent>,
|
||||
}
|
||||
|
||||
/// VecDeltaCodec.encode.
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user