Skip to content

Graph viewer optimizations - #1616

Merged
matlabbe merged 11 commits into
masterfrom
graph_viewer_optimizations
Nov 17, 2025
Merged

matlabbe merged 11 commits into
masterfrom
graph_viewer_optimizations

Conversation

@matlabbe

@matlabbe matlabbe commented Nov 17, 2025 •

Copy link
Copy Markdown
Member

For a map with 10K nodes, processStatistics() when showing only the GraphViewer would take around 40 ms on average instead of 200 ms.

Here is the log of MainWindow before and after the optimizations:

< [ INFO] (2025-11-16 17:14:46.387) MainWindow.cpp:2749::processStats() Updating GUI time = 0.213000s
< [DEBUG] (2025-11-16 17:14:46.536) MainWindow.cpp:1975::processStats() 
< [DEBUG] (2025-11-16 17:14:46.536) MainWindow.cpp:2008::processStats() 
< [DEBUG] (2025-11-16 17:14:46.537) MainWindow.cpp:2290::processStats() time= 0 ms (update detection ui)
< [DEBUG] (2025-11-16 17:14:46.537) MainWindow.cpp:2342::processStats() time= 0 ms (convert image to qt)
< [DEBUG] (2025-11-16 17:14:46.537) MainWindow.cpp:2395::processStats() time= 0 ms (update detection imageviews)
< [DEBUG] (2025-11-16 17:14:46.537) MainWindow.cpp:5023::drawKeypoints() refWords.size() = 371
< [DEBUG] (2025-11-16 17:14:46.537) MainWindow.cpp:5064::drawKeypoints() source time = 0.000352 s
< [DEBUG] (2025-11-16 17:14:46.538) MainWindow.cpp:5067::drawKeypoints() loopWords.size() = 0
< [DEBUG] (2025-11-16 17:14:46.538) MainWindow.cpp:5112::drawKeypoints() loop closure time = 0.000005 s
< [DEBUG] (2025-11-16 17:14:46.538) MainWindow.cpp:5131::drawKeypoints() scale source=0.138542 loop=0.138542
< [DEBUG] (2025-11-16 17:14:46.538) MainWindow.cpp:2416::processStats() time= 0 ms (draw keypoints)
< [DEBUG] (2025-11-16 17:14:46.538) MainWindow.cpp:2460::processStats() time= 0 ms (update likelihood and posterior)
< [DEBUG] (2025-11-16 17:14:46.542) MainWindow.cpp:2477::processStats() time= 4 ms (update stats toolbox)
< [DEBUG] (2025-11-16 17:14:46.543) MainWindow.cpp:2518::processStats() time= 1 ms (update gt-gps stuff)
< [DEBUG] (2025-11-16 17:14:46.543) MainWindow.cpp:2520::processStats() 9206 10947 10947
< [DEBUG] (2025-11-16 17:14:46.544) CloudViewer.cpp:1687::updateCoordinatePose() Updating pose reference to xyz=5.137722,0.578008,0.000000 rpy=0.000000,-0.000000,0.031693
< [DEBUG] (2025-11-16 17:14:46.546) MainWindow.cpp:2798::updateMapCloud() nodes=9206 landmarks=0 constraints=10923 mapIdsIn=9206 labelsIn=7
< [DEBUG] (2025-11-16 17:14:46.550) MainWindow.cpp:2931::updateMapCloud() Update map with 9206 locations
< [DEBUG] (2025-11-16 17:14:46.556) MainWindow.cpp:3187::updateMapCloud() Remove reference_frustum_line_0
< [DEBUG] (2025-11-16 17:14:46.556) MainWindow.cpp:3187::updateMapCloud() Remove reference_frustum_line_2
< [DEBUG] (2025-11-16 17:14:46.556) MainWindow.cpp:3187::updateMapCloud() Remove reference_frustum_line_3
< [DEBUG] (2025-11-16 17:14:46.556) MainWindow.cpp:3193::updateMapCloud() 
< [DEBUG] (2025-11-16 17:14:46.559) MainWindow.cpp:3339::updateMapCloud() timerGraph=0.002141s
< [DEBUG] (2025-11-16 17:14:46.559) MainWindow.cpp:3342::updateMapCloud() labels.size()=7
< [DEBUG] (2025-11-16 17:14:46.559) MainWindow.cpp:3368::updateMapCloud() 
< [DEBUG] (2025-11-16 17:14:46.559) CloudViewer.cpp:1224::removeOctomap() 
< [DEBUG] (2025-11-16 17:14:46.559) MainWindow.cpp:3408::updateMapCloud() 
< [DEBUG] (2025-11-16 17:14:46.561) GraphViewer.cpp:518::updateGraph() poses=9206 constraints=10923
< [DEBUG] (2025-11-16 17:14:46.716) GraphViewer.cpp:789::updateGraph() _nodeItems=9206, _linkItems=10717, timer=0.155148s
< [DEBUG] (2025-11-16 17:14:46.716) GraphViewer.cpp:798::updateGTGraph() poses=0
< [DEBUG] (2025-11-16 17:14:46.716) GraphViewer.cpp:930::updateGTGraph() _gtNodeItems=0, _gtLinkItems=0 timer=0.000003s
< [DEBUG] (2025-11-16 17:14:46.717) GlobalMap.cpp:130::update() Update (poses=9206 addedNodes_=9205)
< [DEBUG] (2025-11-16 17:14:46.719) GlobalMap.cpp:146::update() Pose 10947 not found in current added poses, it will be added to map
< [DEBUG] (2025-11-16 17:14:46.719) OccupancyGrid.cpp:226::assemble() Updating from cache
< [DEBUG] (2025-11-16 17:14:46.719) OccupancyGrid.cpp:233::assemble() Adding grid 10947: ground=0 obstacles=69 empty=403
< [DEBUG] (2025-11-16 17:14:46.719) OccupancyGrid.cpp:369::assemble() map min=(-7.704803, -82.557892) odlMin(-7.704803,-82.557892) max=(152.495209,9.242111)
< [DEBUG] (2025-11-16 17:14:46.719) OccupancyGrid.cpp:384::assemble() Map same size!
< [DEBUG] (2025-11-16 17:14:46.719) OccupancyGrid.cpp:424::assemble() map 534 306
< [DEBUG] (2025-11-16 17:14:46.719) OccupancyGrid.cpp:427::assemble() first pose= 10947 last pose=10947
< [DEBUG] (2025-11-16 17:14:46.720) OccupancyGrid.cpp:671::assemble() Occupancy Grid update time = 0.000241 s
< [DEBUG] (2025-11-16 17:14:46.720) OccupancyGrid.cpp:131::getMap() Converting map from probabilities (thr=0.500000) = 0.000289s
< [DEBUG] (2025-11-16 17:14:46.720) OccupancyGrid.cpp:137::getMap() Eroding map = 0.000237s
< [DEBUG] (2025-11-16 17:14:46.730) MainWindow.cpp:3549::updateMapCloud() 
< [DEBUG] (2025-11-16 17:14:46.730) MainWindow.cpp:3557::updateMapCloud() 
< [DEBUG] (2025-11-16 17:14:46.730) MainWindow.cpp:3637::updateMapCloud() 
< [DEBUG] (2025-11-16 17:14:46.730) MainWindow.cpp:3639::updateMapCloud() 
< [DEBUG] (2025-11-16 17:14:46.732) MainWindow.cpp:2594::processStats() time= 189 ms (update map cloud)
< [DEBUG] (2025-11-16 17:14:46.739) GraphViewer.cpp:1199::setGlobalPath() Set global path size=0
< [DEBUG] (2025-11-16 17:14:46.739) MainWindow.cpp:2680::processStats() time= 6 ms (update graph view)
< [DEBUG] (2025-11-16 17:14:46.739) MainWindow.cpp:2737::processStats() time= 0 ms (update cache)
< [ INFO] (2025-11-16 17:14:46.739) MainWindow.cpp:2749::processStats() Updating GUI time = 0.202000s
---
> [ INFO] (2025-11-16 17:07:09.615) MainWindow.cpp:2771::processStats() Updating GUI time = 0.048000s
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:1973::processStats() 
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:2006::processStats() 
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:2302::processStats() time= 0 ms (update detection ui)
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:2354::processStats() time= 0 ms (convert image to qt)
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:2402::processStats() time= 0 ms (update detection imageviews)
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:5054::drawKeypoints() refWords.size() = 477
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:5095::drawKeypoints() source time (shown=0) = 0.000006 s
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:5098::drawKeypoints() loopWords.size() = 0
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:5159::drawKeypoints() loop closure time (shown=1) = 0.000005 s
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:5183::drawKeypoints() scale source=0.125000 loop=0.125000
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:2436::processStats() time= 0 ms (draw keypoints)
> [DEBUG] (2025-11-16 17:07:10.020) MainWindow.cpp:2480::processStats() time= 0 ms (update likelihood and posterior)
> [DEBUG] (2025-11-16 17:07:10.024) MainWindow.cpp:2497::processStats() time= 3 ms (update stats toolbox)
> [DEBUG] (2025-11-16 17:07:10.025) MainWindow.cpp:2538::processStats() time= 1 ms (update gt-gps stuff)
> [DEBUG] (2025-11-16 17:07:10.025) MainWindow.cpp:2540::processStats() 9194 10913 10913
> [DEBUG] (2025-11-16 17:07:10.026) MainWindow.cpp:2820::updateMapCloud() nodes=9194 landmarks=0 constraints=10900 mapIdsIn=9198 labelsIn=6
> [DEBUG] (2025-11-16 17:07:10.030) MainWindow.cpp:2957::updateMapCloud() Update map with 9194 locations
> [DEBUG] (2025-11-16 17:07:10.035) MainWindow.cpp:3081::updateMapCloud() Uncompressed local occupancy grid of node 10913 (0.000005 s)
> [DEBUG] (2025-11-16 17:07:10.036) MainWindow.cpp:3221::updateMapCloud() 
> [DEBUG] (2025-11-16 17:07:10.037) MainWindow.cpp:3373::updateMapCloud() labels.size()=6
> [DEBUG] (2025-11-16 17:07:10.037) MainWindow.cpp:3399::updateMapCloud() 
> [DEBUG] (2025-11-16 17:07:10.037) CloudViewer.cpp:1224::removeOctomap() 
> [DEBUG] (2025-11-16 17:07:10.037) MainWindow.cpp:3439::updateMapCloud() 
> [DEBUG] (2025-11-16 17:07:10.038) GraphViewer.cpp:522::updateGraph() poses=9194 constraints=10900 mapIds=9198 weights=0
> [DEBUG] (2025-11-16 17:07:10.040) GraphViewer.cpp:527::updateGraph() hidden 10706 links
> [DEBUG] (2025-11-16 17:07:10.040) GraphViewer.cpp:600::updateGraph() Nodes created=0, reused=0 removed=0
> [DEBUG] (2025-11-16 17:07:10.055) GraphViewer.cpp:774::updateGraph() Links created=1, reused=10706, small links: removed=0 ignored=193
> [DEBUG] (2025-11-16 17:07:10.055) GraphViewer.cpp:792::updateGraph() Links removed=0, visible=10707
> [DEBUG] (2025-11-16 17:07:10.055) GraphViewer.cpp:804::updateGraph() _nodeItems=0, _linkItems=10707, timer=0.017052s
> [DEBUG] (2025-11-16 17:07:10.056) GraphViewer.cpp:817::updateGTGraph() poses=0
> [DEBUG] (2025-11-16 17:07:10.056) GraphViewer.cpp:948::updateGTGraph() _gtNodeItems=0, _gtLinkItems=0 timer=0.000003s
> [DEBUG] (2025-11-16 17:07:10.057) GlobalMap.cpp:130::update() Update (poses=9194 addedNodes_=9193)
> [DEBUG] (2025-11-16 17:07:10.059) GlobalMap.cpp:160::update() 1 nodes will be assembled in the map and 0 nodes won't (no local grids in cache for them)
> [DEBUG] (2025-11-16 17:07:10.059) OccupancyGrid.cpp:226::assemble() Updating from cache
> [DEBUG] (2025-11-16 17:07:10.059) OccupancyGrid.cpp:233::assemble() Adding grid 10913: ground=0 obstacles=87 empty=362
> [DEBUG] (2025-11-16 17:07:10.059) OccupancyGrid.cpp:369::assemble() map min=(-7.704798, -82.704994) odlMin(-7.704798,-82.704994) max=(152.495209,9.395012)
> [DEBUG] (2025-11-16 17:07:10.059) OccupancyGrid.cpp:384::assemble() Map same size!
> [DEBUG] (2025-11-16 17:07:10.059) OccupancyGrid.cpp:424::assemble() map 534 307
> [DEBUG] (2025-11-16 17:07:10.059) OccupancyGrid.cpp:427::assemble() first pose= 10913 last pose=10913
> [DEBUG] (2025-11-16 17:07:10.059) OccupancyGrid.cpp:671::assemble() Occupancy Grid update time = 0.000304 s
> [DEBUG] (2025-11-16 17:07:10.060) OccupancyGrid.cpp:131::getMap() Converting map from probabilities (thr=0.500000) = 0.000389s
> [DEBUG] (2025-11-16 17:07:10.060) OccupancyGrid.cpp:137::getMap() Eroding map = 0.000255s
> [DEBUG] (2025-11-16 17:07:10.060) MainWindow.cpp:3580::updateMapCloud() 
> [DEBUG] (2025-11-16 17:07:10.060) MainWindow.cpp:3588::updateMapCloud() 
> [DEBUG] (2025-11-16 17:07:10.060) MainWindow.cpp:3668::updateMapCloud() 
> [DEBUG] (2025-11-16 17:07:10.060) MainWindow.cpp:3670::updateMapCloud() 
> [DEBUG] (2025-11-16 17:07:10.063) MainWindow.cpp:2616::processStats() time= 37 ms (update map cloud)
> [DEBUG] (2025-11-16 17:07:10.065) GraphViewer.cpp:1216::setGlobalPath() Set global path size=0
> [DEBUG] (2025-11-16 17:07:10.065) MainWindow.cpp:2702::processStats() time= 2 ms (update graph view)
> [DEBUG] (2025-11-16 17:07:10.065) MainWindow.cpp:2759::processStats() time= 0 ms (update cache)
> [ INFO] (2025-11-16 17:07:10.065) MainWindow.cpp:2771::processStats() Updating GUI time = 0.045000s

The remaining largest contributor is how we update the links in the Graph Viewer (GraphViewer::updateGraph()), which took 17 ms in this case:

> [DEBUG] (2025-11-16 17:07:10.038) GraphViewer.cpp:522::updateGraph() poses=9194 constraints=10900 mapIds=9198 weights=0
> [DEBUG] (2025-11-16 17:07:10.040) GraphViewer.cpp:527::updateGraph() hidden 10706 links
> [DEBUG] (2025-11-16 17:07:10.040) GraphViewer.cpp:600::updateGraph() Nodes created=0, reused=0 removed=0
> [DEBUG] (2025-11-16 17:07:10.055) GraphViewer.cpp:774::updateGraph() Links created=1, reused=10706, small links: removed=0 ignored=193

@matlabbe
matlabbe merged commit e75baec into master Nov 17, 2025
@matlabbe
matlabbe deleted the graph_viewer_optimizations branch November 17, 2025 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant