[mod_python] Module importer issues list updated.

Nicolas Lehuen nicolas.lehuen at gmail.com
Fri Feb 3 12:20:45 EST 2006

D:\projets\mod_python\test>python -m timeit -n 100000 -s "import os"
100000 loops, best of 3: 46 usec per loop


2006/2/3, Deron Meranda <deron.meranda at gmail.com>:
> > I think it would be nice if you'd include what is usually the IO penalty
> > for all those stat() calls to determine whether a module has changed
> > or not.
> I don't know about Windows, but under a wide variety of Unixes,
> including Linux, the stat call can be one of the cheapest to make,
> as long as the file is not on a network mounted filesystem (NFS).
> For example on my Intel Linux PC,
> 1,000,000 stat calls in C:  2 seconds
> 1,000,000 stat calls in Python: 9 seconds
> The reason it's so fast is, except for the first time, the disk is
> never accessed.  It's all cached in kernel memory.  And the kernel
> knows when the file is updated for local filesystems.
> You don't need to worry about time.time() or datetime.datetime.utcnow()
> and such.  Those are nearly about 20% faster that stat.
> However the one big caveat is that for NFS mounted filesystems
> the time for stat can go up by a factor of 100 times or more, since
> each call involves an RPC across the network.
> Anybody care to check the timing under Windows?
> --
> Deron Meranda
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list