2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 17:07:06 +00:00

used cache instead of .get query, vastly faster

This commit is contained in:
2025-07-21 18:29:06 +02:00
parent 2039501672
commit b5540fd543
3 changed files with 74 additions and 37 deletions

View File

@@ -2338,22 +2338,22 @@ def FindAndLoadSurvex():
fcollate.write(f";*include {survexfileroot.path}\n")
flinear.write(f"{svx_scan.depthinclude:2} {indent} *include {survexfileroot.path}\n")
import cProfile
import pstats
from pstats import SortKey
# import cProfile
# import pstats
# from pstats import SortKey
pr = cProfile.Profile()
pr.enable()
# pr = cProfile.Profile()
# pr.enable()
svx_scan.svxpass = svx_scan.TREE
# ----------------------------------------------------------------
svx_scan.PushdownStackScan(survexblockroot, survexfileroot.path, finrootname, flinear, fcollate)
# ----------------------------------------------------------------
svx_scan.svxpass = ""
pr.disable()
with open("PushdownStackScan.prof", "w") as f:
ps = pstats.Stats(pr, stream=f)
ps.sort_stats(SortKey.CUMULATIVE)
ps.print_stats()
# pr.disable()
# with open("PushdownStackScan.prof", "w") as f:
# ps = pstats.Stats(pr, stream=f)
# ps.sort_stats(SortKey.CUMULATIVE)
# ps.print_stats()
flinear.write(f"{svx_scan.depthinclude:2} {indent} *edulcni {survexfileroot.path}\n")
fcollate.write(f";*edulcni {survexfileroot.path}\n")
@@ -2709,7 +2709,8 @@ def parse_one_file(fpath): # --------------------------------------in progress--
print(f" - Aborting file parsing & import into database.")
return False
print(f" - Pre-existing survexfile {svxs}.")
existingsvx = SurvexFile.objects.get(path=fpath)
existingsvx = svxs[0]
#existingsvx = SurvexFile.objects.get(path=fpath)
existingcave = existingsvx.cave
print(f" - survexfile id={existingsvx.id} {existingsvx} {existingcave}")