Say, I have a code which calls some function millions time from loop and I want the code to be fast:
def outer_function(file):
for line in file:
inner_function(line)
def inner_function(line):
# do something
pass
It's not necessarily a file processing, it could be for example a function drawing point called from function drawing line. The idea is that logically these two have to be separated, but from performance point of view they should act together as fast as possible.
Does Python detects and optimizes such things automatically? If not - is there a way to give it a clue to do so? Use some additional external optimizer maybe?...