[Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like info

Antoine Pitrou solipsis at pitrou.net
Tue May 14 11:57:16 CEST 2013


Le Tue, 14 May 2013 21:10:08 +1200,
Ben Hoyt <benhoyt at gmail.com> a écrit :
> > On a locally running VM:
> > os.walk took 0.400s, scandir.walk took 0.120s -- 3.3x as fast
> >
> > Same VM accessed from the host through a local sshfs:
> > os.walk took 2.261s, scandir.walk took 2.055s -- 1.1x as fast
> >
> > Same, but with "sshfs -o cache=no":
> > os.walk took 24.060s, scandir.walk took 25.906s -- 0.9x as fast
> 
> Thanks. I take it those are "USING FAST C version"?

Yes.

> What is "-o cache=no"? I'm guessing the last one isn't giving dirents,
> so my version is slightly slower than the built-in listdir/stat
> version due to building and calling methods on the DirEntry objects in
> Python.

It disables sshfs's built-in cache (I suppose it's a filesystem
metadata cache). The man page doesn't tell much more about it.

> It should be no slower when it's all moved to C.

The slowdown is too small to be interesting. The main point is that
there was no speedup, though.

Regards

Antoine.




More information about the Python-Dev mailing list