[mod_python] Module importer issues list updated.

Deron Meranda deron.meranda at gmail.com
Fri Feb 3 10:44:56 EST 2006


> 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



More information about the Mod_python mailing list