Optimize chunk loading
- Chunk loading now is done in a more simple manner. Instead of splitting it into regions and having one file handle for all chunks in the same region, now all chunks make their own file handle for the region, the previous overhead was not worth it, since this seemed to increase performance. - Speed up of ~15% - Now the `.read_chunks` function does not return anything, instead it sends event to an mpsc channel. - Dramatically decreased memory footprint.
This commit is contained in:
1 parent
96b86f1e9b
commit
03f9b377d5
4 files changed
+128
-139
No files matched your search
@@ -32,7 +32,7 @@ use fastnbt::LongArray;
|
||||
use crate::{world::WorldError, WORLD_HEIGHT};
|
||||
|
||||
pub struct ChunkData {
|
||||
pub blocks: Box<[i64; 16 * 16 * WORLD_HEIGHT]>,
|
||||
pub blocks: Box<[i32; 16 * 16 * WORLD_HEIGHT]>,
|
||||
pub position: (i32, i32),
|
||||
pub heightmaps: ChunkHeightmaps,
|
||||
}
|
||||
@@ -96,6 +96,7 @@ impl ChunkData {
|
||||
&entry.name,
|
||||
entry.properties.as_ref(),
|
||||
)
|
||||
.map(|v| v as i32)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
let block_data = match block_states.data {
|
||||
|
||||
Reference in new issue
Block a user