From 57aee57d8283cc0d0fed9b3ade816a2e929803c2 Mon Sep 17 00:00:00 2001 From: Avi Weinstock Date: Sun, 25 Apr 2021 16:18:57 -0400 Subject: [PATCH] Downgrade deflate from level 5 to level 1 in the terrain system to match LZ4's worst-case encoding time. --- server/src/sys/msg/terrain.rs | 2 +- server/src/sys/terrain.rs | 2 +- server/src/sys/terrain_sync.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/sys/msg/terrain.rs b/server/src/sys/msg/terrain.rs index 78209ef68b..120098b444 100644 --- a/server/src/sys/msg/terrain.rs +++ b/server/src/sys/msg/terrain.rs @@ -79,7 +79,7 @@ impl<'a> System<'a> for Sys { network_metrics.chunks_served_from_memory.inc(); client.send(ServerGeneral::TerrainChunkUpdate { key, - chunk: Ok(CompressedData::compress(&chunk, 5)), + chunk: Ok(CompressedData::compress(&chunk, 1)), })? }, None => { diff --git a/server/src/sys/terrain.rs b/server/src/sys/terrain.rs index 42778912e9..3cb95f40d6 100644 --- a/server/src/sys/terrain.rs +++ b/server/src/sys/terrain.rs @@ -224,7 +224,7 @@ impl<'a> System<'a> for Sys { new_chunks.into_par_iter().for_each(|(key, chunk)| { let mut msg = Some(ServerGeneral::TerrainChunkUpdate { key, - chunk: Ok(CompressedData::compress(&*chunk, 5)), + chunk: Ok(CompressedData::compress(&*chunk, 1)), }); let mut lazy_msg = None; diff --git a/server/src/sys/terrain_sync.rs b/server/src/sys/terrain_sync.rs index 305427457b..1992b68d99 100644 --- a/server/src/sys/terrain_sync.rs +++ b/server/src/sys/terrain_sync.rs @@ -38,7 +38,7 @@ impl<'a> System<'a> for Sys { lazy_msg = Some(client.prepare(ServerGeneral::TerrainChunkUpdate { key: *chunk_key, chunk: Ok(match terrain.get_key(*chunk_key) { - Some(chunk) => CompressedData::compress(&chunk, 5), + Some(chunk) => CompressedData::compress(&chunk, 1), None => break 'chunk, }), })); @@ -55,7 +55,7 @@ impl<'a> System<'a> for Sys { for (_, client) in (&presences, &clients).join() { if lazy_msg.is_none() { lazy_msg = Some(client.prepare(ServerGeneral::TerrainBlockUpdates( - CompressedData::compress(&terrain_changes.modified_blocks, 2), + CompressedData::compress(&terrain_changes.modified_blocks, 1), ))); } lazy_msg.as_ref().map(|ref msg| client.send_prepared(&msg));