Compressing with lz4
This commit is contained in:
+21
-17
@@ -27,27 +27,31 @@ impl Game {
|
||||
world: World::new("default".to_string())
|
||||
};
|
||||
|
||||
|
||||
// Try to load world from file
|
||||
let timer = Instant::now();
|
||||
for x in 0..64 {
|
||||
for z in 0..64 {
|
||||
let pos = &Point3{x,y:0,z};
|
||||
let block = app.world.gen_block(pos);
|
||||
content.write(pos, block);
|
||||
if app.world.load() {
|
||||
for (pos, block) in app.world.all_blocks() {
|
||||
content.write(&pos, block);
|
||||
}
|
||||
println!("Loaded in {}", timer.elapsed().as_secs_f32());
|
||||
}
|
||||
// Generate new world
|
||||
else {
|
||||
let timer = Instant::now();
|
||||
for x in 0..32 {
|
||||
for z in 0..32 {
|
||||
let pos = &Point3{x,y:0,z};
|
||||
let block = app.world.gen_block(pos);
|
||||
content.write(pos, block);
|
||||
}
|
||||
}
|
||||
println!("Generated in {}", timer.elapsed().as_secs_f32());
|
||||
|
||||
let timer = Instant::now();
|
||||
app.world.save();
|
||||
println!("Saved in {}", timer.elapsed().as_secs_f32());
|
||||
}
|
||||
println!("Generated in {}", timer.elapsed().as_secs_f32());
|
||||
|
||||
let timer = Instant::now();
|
||||
app.world.save();
|
||||
println!("Saved in {}", timer.elapsed().as_secs_f32());
|
||||
|
||||
// let timer = Instant::now();
|
||||
// app.world.load();
|
||||
// for (pos, block) in app.world.all_blocks() {
|
||||
// content.write(&pos, block);
|
||||
// }
|
||||
// println!("Loaded in {}", timer.elapsed().as_secs_f32());
|
||||
|
||||
println!("App initialized");
|
||||
app
|
||||
|
||||
Reference in New Issue
Block a user