On 07Jun2015 08:20, Cecil Westerhof <ce...@decebal.nl> wrote:
There is no gain to get in standard Python? By switching from fnmatch to re I got almost a speed gain of two. So I was wondering if I could do more.
Maybe write a few versions: one really dumb using filename == matchstring (like -name foo), one using filename.startswith(matchstring) (like -name '*foo'), one using matchstring in filename (like -name '*foo*') and your current one. See how much these affect the runtime. You _will_ need to make multiple identical runs (OSes do lots of caching, and other processes competing for I/O or the CPU will also perturb things).
One the topic of multiple runs, have a look at the timeit module, psecificly designed for testing code with multiple runs.
Cheers, Cameron Simpson <c...@zip.com.au> -- https://mail.python.org/mailman/listinfo/python-list