From df3be0b73eb3e04104b251baf5cd1d0f9873442d Mon Sep 17 00:00:00 2001 From: Herbert Wolverson Date: Fri, 21 Apr 2023 13:22:07 +0000 Subject: [PATCH] Speed up integrationUISP.py * Adds one more "is not none" check for a line that failed on my installation. * Add a level of indentation to the inner "walkGraph" function, so it doesn't painstakingly check every node when it already knows that it won't pick them (for a route cost). My testing gave the same results, substantially faster. --- src/integrationUISP.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/integrationUISP.py b/src/integrationUISP.py index 46c78310..6cad4df6 100644 --- a/src/integrationUISP.py +++ b/src/integrationUISP.py @@ -221,13 +221,13 @@ def walkGraphOutwards(siteList, root, routeOverrides): site['parent'] = parent['id'] #print(debugSpaces(cost/10) + parent['name'] + "->" + site['name'] + " -> New cost: " + str(cost)) - for connection in site['connections']: - if not connection in backPath: - #target = findInSiteListById(siteList, connection) - #print(debugSpaces((cost+10)/10) + site['name'] + " -> " + target['name'] + " (" + str(target['cost']) + ")") - newBackPath = backPath.copy() - newBackPath.append(site['id']) - walkGraph(connection, site, cost+10, newBackPath) + for connection in site['connections']: + if not connection in backPath: + #target = findInSiteListById(siteList, connection) + #print(debugSpaces((cost+10)/10) + site['name'] + " -> " + target['name'] + " (" + str(target['cost']) + ")") + newBackPath = backPath.copy() + newBackPath.append(site['id']) + walkGraph(connection, site, cost+10, newBackPath) for connection in root['connections']: # Force the parent since we're at the top