Remove some bottlenecks.

This commit is contained in:
Joshua Yanovski 2022-07-01 20:41:59 -07:00
parent 0b14ca2f3a
commit 59aacc3fd8
4 changed files with 6 additions and 6 deletions

View File

@ -1778,7 +1778,7 @@ impl Client {
if self.state.terrain().get_key(*key).is_none() { if self.state.terrain().get_key(*key).is_none() {
if !skip_mode && !self.pending_chunks.contains_key(key) { if !skip_mode && !self.pending_chunks.contains_key(key) {
const TOTAL_PENDING_CHUNKS_LIMIT: usize = 1024; const TOTAL_PENDING_CHUNKS_LIMIT: usize = 1024;
const CURRENT_TICK_PENDING_CHUNKS_LIMIT: usize = 8; const CURRENT_TICK_PENDING_CHUNKS_LIMIT: usize = 8 * 4;
if self.pending_chunks.len() < TOTAL_PENDING_CHUNKS_LIMIT if self.pending_chunks.len() < TOTAL_PENDING_CHUNKS_LIMIT
&& current_tick_send_chunk_requests && current_tick_send_chunk_requests
< CURRENT_TICK_PENDING_CHUNKS_LIMIT < CURRENT_TICK_PENDING_CHUNKS_LIMIT

View File

@ -47,11 +47,11 @@ impl<'a> System<'a> for Sys {
chunk_sender, chunk_sender,
): Self::SystemData, ): Self::SystemData,
) { ) {
// Only operate twice per second /* // Only operate twice per second
//TODO: move out of this system and now even spawn this. //TODO: move out of this system and now even spawn this.
if tick.0.rem_euclid(15) != 0 { if tick.0.rem_euclid(15) != 0 {
return; return;
} } */
struct Metadata { struct Metadata {
recipients: Vec<Entity>, recipients: Vec<Entity>,

View File

@ -210,7 +210,7 @@ fn calc_light<V: RectRasterableVol<Vox = Block> + ReadVol + Debug>(
drop(light_map); */ drop(light_map); */
move |wpos| { move |wpos| {
1.0 if is_sunlight { 1.0 } else { 0.0 }
/* let pos = wpos - min_bounds.min; /* let pos = wpos - min_bounds.min;
let l = light_map2 let l = light_map2
.get(lm_idx2(pos.x, pos.y, pos.z)) .get(lm_idx2(pos.x, pos.y, pos.z))

View File

@ -970,7 +970,7 @@ impl<V: RectRasterableVol> Terrain<V> {
})?)) })?))
}) })
{ {
if self.mesh_todos_active.load(Ordering::Relaxed) > meshing_cores { if self.mesh_todos_active.load(Ordering::Relaxed) > meshing_cores * 8 {
break; break;
} }
@ -1056,7 +1056,7 @@ impl<V: RectRasterableVol> Terrain<V> {
// store it. Vary the rate at which we pull items out to correlate with the // store it. Vary the rate at which we pull items out to correlate with the
// framerate, preventing tail latency. // framerate, preventing tail latency.
span!(guard, "Get/upload meshed chunk"); span!(guard, "Get/upload meshed chunk");
const CHUNKS_PER_SECOND: f32 = 240.0; const CHUNKS_PER_SECOND: f32 = 240.0 * 8.0;
let recv_count = let recv_count =
scene_data.state.get_delta_time() * CHUNKS_PER_SECOND + self.mesh_recv_overflow; scene_data.state.get_delta_time() * CHUNKS_PER_SECOND + self.mesh_recv_overflow;
self.mesh_recv_overflow = recv_count.fract(); self.mesh_recv_overflow = recv_count.fract();