This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: glob.glob speedups
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: hooft, loewis
Priority: normal Keywords: patch

Created on 2001-03-20 09:57 by hooft, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
glob.diff hooft, 2001-03-20 09:57
Messages (2)
msg36134 - (view) Author: Rob W.W. Hooft (hooft) Date: 2001-03-20 09:57
A lot of the time spent by glob.glob on large
directories is spent doing os.path.normcase(). Half of
this can be saved by normcasing the pattern only once,
and on unix the whole normcase call can be left out.

This patch attempts to optimize globbing even a bit
more by delegating the fnmatching of a list of file
names to a new function fnmatch.filter, which allows us
to move a few more lookups outside of the file name
loop.

Furthermore, an optimization is added to glob.glob
calls that do not contain any directory specifications,
saving a round of os.path.join calls.

Speedups of the pattern '*.py?' in the python lib
directory range
from a factor of 2 with directory specification to a
factor of 5 without directory specifications.

Unfortunately there is no test_glob regression test,
but I did my best to verify that nothing changed in my
calls.
msg36135 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2001-06-06 06:27
Logged In: YES 
user_id=21627

Committed as glob.py 1.10 and fnmatch.py 1.12.
History
Date User Action Args
2022-04-10 16:03:53adminsetgithub: 34195
2001-03-20 09:57:00hooftcreate