Brett Cannon added the comment:

I also just tried using os.listdir() for a package before searching for 
__init__ and it didn't speed anything up either (actually timeit suggests that 
os.listdir() is worse than an isdir + 3 * isfile checks). Nor did caching 
directory stuff at the class level so that they were shared when an 
os.listdir() was done for an __init__ so that didn't have to be done a second 
time if the cache wasn't stale already.

I have attached the patch with all of the changes to cut the number of stat 
calls down significantly, but benchmarking on my work machine shows no 
definitive benefit.

----------
keywords: +patch
Added file: http://bugs.python.org/file31510/less_stats.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18810>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to