Cut the dijkstra_algorithm.py time in half with various tricks#15
Cut the dijkstra_algorithm.py time in half with various tricks#15Mortal wants to merge 1 commit into
Conversation
Implement a number of performance optimizations that altogether cut down the running time to about half, as tested with a 2905 * 4029 raster with 1 start point and 1 end point. * Don't use queue.PriorityQueue, as it is a threadsafe queue with unnecessary locking - use heapq.heappush() and heappop() instead. * Don't use function calls - instead, inline all functions. Almost all the functions in the old code were only used in one place. * Instead of dicts and sets, use lists of lists, which have faster lookup. * Reduce the number of calls to feedback.setProgress().
|
Hi @Mortal, thanks for the improvement. Will review and test this PR and release soon! |
|
QGIS version: 3.40.2-Bratislava The size of cost raster is: 6401 * 5378 Execution failed after 8.32 seconds Loading resulting layers |
|
Commenting out line 90 (its), crashes QGIS. The PR doesn't work for me. Python Stack Trace Current thread 0x000089e8 (most recent call first): Thread 0x00007d7c (most recent call first): Stack Trace PyInit_sip : QGIS Info System Info |
Implement a number of performance optimizations that altogether cut down the running time to about half, as tested with a 2905 * 4029 raster with 1 start point and 1 end point.
Don't use queue.PriorityQueue, as it is a threadsafe queue with unnecessary locking - use heapq.heappush() and heappop() instead.
Don't use function calls - instead, inline all functions. Almost all the functions in the old code were only used in one place.
Instead of dicts and sets, use lists of lists, which have faster lookup.
Reduce the number of calls to feedback.setProgress().