[Python-Dev] Issue #11051: system calls per import
brett at python.org
Mon Jan 31 19:38:57 CET 2011
On Mon, Jan 31, 2011 at 04:43, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Mon, 31 Jan 2011 00:08:25 -0800
> Guido van Rossum <guido at python.org> wrote:
>> (Basically I am biased to believe that stat() is a pretty slow system
>> call -- this may just be old NFS lore though.)
> I don't know about NFS, but starting a Python interpreter located on a
> Samba share from a Windows VM is quite slow too.
> I think Martin is right for the common case: on a local filesystem on a
> modern Unix, stat() is certainly very fast. Remote or
> distributed filesystems seem to be more of a problem.
I should mention that I have considered implementing a caching finder
and loader for filesystems in importlib for people to optionally
install to use for themselves. The real trick, though, is should it
only cache hits, misses, or both? Regardless, though, it would be a
very simple mixin or subclass to implement if there is demand for this
sort of thing.
And as for the zipfile being faster, that's true (I have incomplete
benchmarks in importlib that you can use if people want to measure
this stuff themselves, although you will need to tweak them to run
against a zipfile).
More information about the Python-Dev