Closed thenineteen closed 3 years ago
Go to this commit ID fe37932e347c6b993c5c486d0832e4f3ded6717d (alternatively look at section below on how to add profiler)
Run slicer and your query, which should output svt.profile
file to working tree
In SemiologyVisualisation.py
add import cProfile
to the top of the file and add this method:
def updateColorsWithProfile(self):
p = cProfile.Profile()
p.runcall(self.updateColors)
p.dump_stats('C:\\svt.profile')
Then update this line in def makeUpdateButton(self)
from:
self.updateButton.clicked.connect(self.updateColors)
to
self.updateButton.clicked.connect(self.updateColorsWithProfile)
You can now pip install cprofilev
and run cprofilev -f svt.profile
to serve up the profiler result and browse through it like so:
Or you can pip install pyprof2calltree
and convert the profile file to calltree using pyprof2calltree -i svt.profile -o svt.calltree
and then use qcachegrind (https://sourceforge.net/projects/qcachegrindwin/) to view svt.calltree
QUERY_LATERALISATION calls to pivot_result_to_one_map are next to be made more efficient
Tested on SVT/Slicer in addition to benchmarking, using Head Version Right and Hypomotor Right: Overall saves upto 50%: 6-7 seconds from 14 seconds (maximum time saved if
show progress while updating colors
in slicer/SVT is disabled anduse cache when available
is enabled.)Dealt initially with the largest bottlenecks:
1 445821e and deb395e410c803dd183331c551e3a7cba626bfce reduce verbosity of output by disabling tqdm by default
2 #5 These were slow, but also the way cache was being loaded and written to turned out to be computationally expensive as loading yaml is computationally expensive (who knew!). Changed the order for cache to be loaded only if option is checked in fe37932. Also saved one second by removing delayDisplay popup in 1d6624c.