Use zstd compression level 9

This commit is contained in:
crumblingstatue 2023-04-14 12:03:22 +02:00
parent 30a41dc2a5
commit 6d12d5c048

View file

@ -46,6 +46,8 @@ pub struct World {
pub name: String, pub name: String,
} }
const COMP_LEVEL: i32 = 9;
impl World { impl World {
pub fn new(spawn_point: WorldPos, name: &str) -> Self { pub fn new(spawn_point: WorldPos, name: &str) -> Self {
Self { Self {
@ -81,7 +83,10 @@ impl World {
let mut f = File::create(&reg_file_name).unwrap(); let mut f = File::create(&reg_file_name).unwrap();
// Write an empty existence bitset // Write an empty existence bitset
f.write_all(&[0; 8]).unwrap(); f.write_all(&[0; 8]).unwrap();
log::info!("{:?}", f.write_all(&zstd::encode_all(&[][..], 0).unwrap())); log::info!(
"{:?}",
f.write_all(&zstd::encode_all(&[][..], COMP_LEVEL).unwrap())
);
} }
let mut f = OpenOptions::new() let mut f = OpenOptions::new()
.read(true) .read(true)
@ -114,7 +119,7 @@ impl World {
.unwrap(); .unwrap();
log::info!( log::info!(
"{:?}", "{:?}",
f.write_all(&zstd::encode_all(&decomp[..], 0).unwrap()) f.write_all(&zstd::encode_all(&decomp[..], COMP_LEVEL).unwrap())
); );
} }
} }