I use os.walkto build a data warehouse map (this map is used later in the tool that I create)
This is the code I'm currently using:
def find_children(tickstore):
children = []
dir_list = os.walk(tickstore)
for i in dir_list:
children.append(i[0])
return children
I did some analysis:
dir_list = os.walk(tickstore)runs instantly, if I do nothing with dir_list, then this function ends instantly.
Iterates over dir_list, which takes a lot of time, even if I am not doing appendsomething, just repeating it, this is what takes time.
Tickstore is a large data warehouse with ~ 10,000 directories.
It currently takes about 35 minutes to complete this function.
Is there any way to speed it up?
os.walk, , , .