Skip to content

Commit bc6f119

Browse files
committed
No compression
1 parent c874f8e commit bc6f119

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/database/chunks.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ impl<'a, T: Encode + 'a> BytesEncode<'a> for Zstd<T> {
2626
fn bytes_encode(item: &'a Self::EItem) -> Result<Cow<'a, [u8]>, heed::BoxedError> {
2727

2828
// Compress
29-
let mut bytes = Vec::new();
29+
/*let mut bytes = Vec::new();
3030
let mut compressor = zstd::Encoder::new(&mut bytes, 6)?;
3131
bincode::encode_into_std_write(item, &mut compressor, standard())?;
32-
compressor.finish()?;
32+
compressor.finish()?;*/
33+
let bytes= bincode::encode_to_vec(item, standard())?;
3334

3435
Ok(Cow::Owned(bytes))
3536
}
@@ -39,10 +40,11 @@ impl<'a, T: Decode + 'a> BytesDecode<'a> for Zstd<T> {
3940
type DItem = T;
4041

4142
fn bytes_decode(bytes: &'a [u8]) -> Result<Self::DItem, heed::BoxedError> {
42-
43-
let mut decompressor = zstd::Decoder::new(bytes)?;
43+
/*let mut decompressor = zstd::Decoder::new(bytes)?;
4444
let decoded = bincode::decode_from_std_read(&mut decompressor, standard())?;
45-
Ok(decoded)
45+
Ok(decoded)*/
46+
let decoded = bincode::decode_from_slice(bytes, standard())?;
47+
Ok(decoded.0)
4648
}
4749
}
4850

@@ -170,6 +172,7 @@ impl Database {
170172
Ok(())
171173
}
172174

175+
#[allow(dead_code)]
173176
async fn load_into_cache(&self, key: u64) -> Result<(), Error> {
174177
Database::load_into_cache_standalone(self.db.clone(), self.cache.clone(), key).await
175178
}

src/database/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::utils::error::Error;
1919
use crate::world::chunk_format::Chunk;
2020
pub mod chunks;
2121

22-
const LMDB_MIN_PAGE_SIZE: usize = 50 * 1024usize.pow(2); // 50MB
22+
const LMDB_MIN_PAGE_SIZE: usize = 1800 * 1024usize.pow(2); // 1800MB
2323
const LMDB_PAGE_SIZE_INCREMENT: usize = 250*1024usize.pow(2); // 250MB
2424
const LMDB_MAX_DBS: u32 = 10;
2525

src/world/importing.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ fn process_chunk(chunk_data: Vec<u8>, file_name: &str, bar: Arc<ProgressBar>) ->
8787
})?;
8888

8989
final_chunk.dimension = Some("overworld".to_string());
90+
9091
Ok(final_chunk)
9192
}
9293

@@ -121,7 +122,6 @@ pub async fn import_regions(state: GlobalState) -> Result<()> {
121122
while !chunks.is_empty() {
122123
let chunk_batch: Vec<ChunkData> = chunks.drain(..std::cmp::min(batch_size, chunks.len())).collect();
123124

124-
let start = std::time::Instant::now();
125125
let processed_chunks: Vec<Chunk> = chunk_batch.into_par_iter()
126126
.filter_map(|chunk| {
127127
let data = chunk.data.clone();
@@ -138,13 +138,9 @@ pub async fn import_regions(state: GlobalState) -> Result<()> {
138138
}
139139
})
140140
.collect();
141-
info!("Processed {} chunks in {:?}", processed_chunks.len(), start.elapsed());
142141

143142
// Insert the batch of processed chunks
144-
let start = std::time::Instant::now();
145-
let chunks_len = processed_chunks.len();
146143
insert_chunks(&state, processed_chunks, &bar).await?;
147-
info!("Inserted {} chunks in {:?}", chunks_len, start.elapsed());
148144
}
149145

150146
/*

0 commit comments

Comments
 (0)