Skip to content

Commit 42450dc

Browse files
committed
Add in some timing logs. Cell rendering is fine.
1 parent ec08a9c commit 42450dc

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

backend/Cargo.lock

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ web-sys = { version = "0.3.64", features = ["console"] }
2424
bincode = "1.3.3"
2525
contour = "0.12.0"
2626
rstar = "0.11.0"
27+
web-time = "1.0.0"

backend/src/neighbourhood.rs

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use geo::{
55
BooleanOps, Contains, EuclideanDistance, EuclideanLength, Intersects, MultiLineString, Polygon,
66
};
77
use geojson::{Feature, FeatureCollection, Geometry};
8+
use web_time::Instant;
89

910
use crate::render_cells::Color;
1011
use crate::{Cell, IntersectionID, MapModel, RenderCells, RoadID, Shortcuts};
@@ -82,13 +83,20 @@ impl Neighbourhood {
8283
}
8384

8485
pub fn after_edit(&mut self, map: &MapModel) {
86+
let t1 = Instant::now();
8587
let cells = Cell::find_all(map, self);
88+
let t2 = Instant::now();
8689
let render_cells = RenderCells::new(map, self, &cells);
90+
let t3 = Instant::now();
8791
let shortcuts = Shortcuts::new(map, self);
92+
let t4 = Instant::now();
8893
self.derived = Some(DerivedNeighbourhoodState {
8994
render_cells,
9095
shortcuts,
9196
});
97+
if false {
98+
info!("Neighbourhood edited. Finding cells took {:?}, rendering cells took {:?}, finding shortcuts took {:?}", t2 - t1, t3 - t2, t4 - t3);
99+
}
92100
}
93101

94102
pub fn to_gj(&self, map: &MapModel) -> FeatureCollection {

backend/src/render_cells.rs

+2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ fn finalize(main_grid: Grid<Option<usize>>, cell_colors: Vec<Color>, bounds: Rec
119119
// contour will find where the grid is >= a threshold value. The main grid has one
120120
// number per cell, so we can't directly use it -- the area >= some cell index is
121121
// meaningless. Per cell, make a new grid that just has that cell.
122+
//
123+
// TODO Try isobands
122124
let grid: Grid<f64> = Grid {
123125
width: main_grid.width,
124126
height: main_grid.height,

0 commit comments

Comments
 (0)