diff --git a/benchmark_results.json b/benchmark_results.json index 2ccc4f4..7206d18 100644 --- a/benchmark_results.json +++ b/benchmark_results.json @@ -1,17 +1,17 @@ { "mode": "graphics", "ticks": 600, - "total_time_ms": 4648.7, - "avg_fps": 129.1, - "avg_frame_time_ms": 7.72, - "p99_frame_time_ms": 11.03, - "min_frame_time_ms": 7.13, + "total_time_ms": 3483.9, + "avg_fps": 172.2, + "avg_frame_time_ms": 5.78, + "p99_frame_time_ms": 14.20, + "min_frame_time_ms": 4.20, "subsystems": { - "ca_step_avg_us": 1121, - "ca_step_p99_us": 1713, - "ca_step_min_us": 496, - "render_avg_us": 3543, - "render_p99_us": 4374, - "render_min_us": 3289 + "ca_step_avg_us": 1397, + "ca_step_p99_us": 10172, + "ca_step_min_us": 303, + "render_avg_us": 3668, + "render_p99_us": 5514, + "render_min_us": 3259 } } \ No newline at end of file diff --git a/src/ui/mod.rs b/src/ui/mod.rs index d477386..da5641a 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -77,6 +77,9 @@ impl UiLayer { } pub fn resize(&mut self, w: usize, h: usize) { + if self.width == w && self.height == h && !self.cells.is_empty() { + return; + } self.width = w; self.height = h; self.cells.clear(); @@ -324,8 +327,8 @@ impl UiLayer { let mut g = 0u32; let mut b = 0u32; let mut n = 0u32; - for yy in 0..scale { - for xx in 0..scale { + for yy in (0..scale).step_by(4) { + for xx in (0..scale).step_by(4) { let cell = grid.get(wx + xx, wy + yy); if cell.material != MaterialId::Empty { let c = cell.fg; diff --git a/src/world/cellular.rs b/src/world/cellular.rs index b15678e..f5cef0f 100644 --- a/src/world/cellular.rs +++ b/src/world/cellular.rs @@ -784,8 +784,14 @@ impl CellularAutomaton { let idx = (ly as usize) * CHUNK_SIZE + (lx as usize); if let Some((radius, color)) = material_light(chunk.cells[idx].material) { sources.push((ox + lx, oy + ly, radius as i32, color)); + if sources.len() >= 64 { + break; + } } } + if sources.len() >= 64 { + break; + } } } } diff --git a/src/world/chunked_grid.rs b/src/world/chunked_grid.rs index e49cad5..7a2b290 100644 --- a/src/world/chunked_grid.rs +++ b/src/world/chunked_grid.rs @@ -123,7 +123,7 @@ impl ChunkedGrid { } let key = (cx as i64, cy as i64); if !self.chunks.contains_key(&key) { - let mut chunk = Chunk::new(); + let chunk = Chunk::new(); if let Some(ref dir) = self.cache_dir { let path = chunk_path(dir, self.seed, cx, cy); if path.exists() {