From 0f0384949d6863c65993ccfafc87dbb330d529f2 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Tue, 1 Mar 2022 15:28:38 +0000 Subject: [PATCH] Speed up cell drawing in Lyon, where logs about leaking out of the boundary happens frequently --- apps/ltn/src/draw_cells.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/ltn/src/draw_cells.rs b/apps/ltn/src/draw_cells.rs index dd1284c475..16a2ba2b52 100644 --- a/apps/ltn/src/draw_cells.rs +++ b/apps/ltn/src/draw_cells.rs @@ -87,6 +87,7 @@ impl RenderCellsBuilder { ); // Initially fill out the grid based on the roads in each cell + let mut warn_leak = true; for (cell_idx, cell) in neighborhood.cells.iter().enumerate() { for (r, interval) in &cell.roads { let road = map.get_r(*r); @@ -111,10 +112,15 @@ impl RenderCellsBuilder { // // Example is https://www.openstreetmap.org/way/87298633 if grid_idx >= grid.data.len() { - warn!( - "{} leaks outside its neighborhood's boundary polygon, near {}", - road.id, pt - ); + if warn_leak { + warn!( + "{} leaks outside its neighborhood's boundary polygon, near {}", + road.id, pt + ); + // In some neighborhoods, there are so many warnings that logging + // causes noticeable slowdown! + warn_leak = false; + } continue; }