If you mean the implementation of find_repos()
, then using os.walk()
is probably not optimal. The reason is that once you find .git
subdirectory, there is no need to search deeper. Try to write your own directory traversal. You can have a look at the sources in os.py
on how the walk
is implemented -- the reason for slowness could be it is written in Python.
For other parts of your new solution... I have noticed that you do not compile regular expressions, but I did not checked details.
I suggest to separate the functionality to another Python script, then measure the solution using timeit
module, and then try to optimize.