I've profiled my code with cProfile to find bottlenecks and I've found a peculiar one.
My code is structured like so:
def A1Distance(a_list):
#returns something
pr = cProfile.Profile()
pr.enable()
x = A1Distance(list_comprehension)
pr.disable()
cProfile has it run for a total of 17.554 seconds. The top function in terms of total time is:
ncalls tottime percall cumtime percall filename:lineno(function)
1 9.884 9.884 17.554 17.554 Cov_Opt_Parallel.py:141(A1Distance)
as you can see, A1Distance takes about 10 seconds and is called once. If I put the pr.enable() and pr.disable() INSIDE the function, it's the same output but without the 10 seconds for A1Distance. Thus, it appears to be taking 10 seconds to merely call a function. Any suggestions for what could be the reason/fix for this?