Speed up cell drawing in Lyon, where logs about leaking out of the boundary happens frequently

This commit is contained in:
Dustin Carlino 2022-03-01 15:28:38 +00:00
parent a421eaf900
commit 0f0384949d

View File

@ -87,6 +87,7 @@ impl RenderCellsBuilder {
); );
// Initially fill out the grid based on the roads in each cell // 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 (cell_idx, cell) in neighborhood.cells.iter().enumerate() {
for (r, interval) in &cell.roads { for (r, interval) in &cell.roads {
let road = map.get_r(*r); let road = map.get_r(*r);
@ -111,10 +112,15 @@ impl RenderCellsBuilder {
// //
// Example is https://www.openstreetmap.org/way/87298633 // Example is https://www.openstreetmap.org/way/87298633
if grid_idx >= grid.data.len() { if grid_idx >= grid.data.len() {
warn!( if warn_leak {
"{} leaks outside its neighborhood's boundary polygon, near {}", warn!(
road.id, pt "{} 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; continue;
} }