On 05/11/2016 05:13 PM, Arthur Darcet wrote: > os.path.getmtime could be used in a tight loop, to sync directories with > a lot of files for instance. > > % python3 -m timeit -s "import os.path; p = 'out'" "hasattr(p, > '__fspath__'), os.path.getmtime(p)" > 100000 loops, best of 3: 2.67 usec per loop > % python3 -m timeit -s "import os.path; p = 'out'" "isinstance(p, (str, > bytes)), os.path.getmtime(p)" > 100000 loops, best of 3: 2.45 usec per loop > % python3 -m timeit -s "import os.path; p = 'out'" "os.path.getmtime(p)" > 100000 loops, best of 3: 2.02 usec per loop > > a 25% markup is a lot imo. I don't think those results are very informative, since os.path.getmtime() accepts both str and bytes, so it must already have the str/bytes check. -- ~Ethan~
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4