A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-May/144531.html below:

[Python-Dev] file system path protocol PEP

[Python-Dev] file system path protocol PEPEthan Furman ethan at stoneleaf.us
Wed May 11 20:40:22 EDT 2016
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~

More information about the Python-Dev mailing list

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