[Python-Dev] Suggestion: stopping to trust os mtimes

Greg Stein gstein@lyra.org
Fri, 2 Jun 2000 12:53:21 -0700 (PDT)


On Fri, 2 Jun 2000, Moshe Zadka wrote:
> Trusting OS-based mtimes for .pyc caching has some inherent problems.
> (Clock syncing and similar) Frankly, though I've never been bitten by
> this, it does give me an uncomfortable feeling. What if, instead, we'd use
> md5- or sha-based approach?

That is an expensive computation. You'd have to read the whole file in and
compute the hash.

Today, we simply stat() each file. If the .pyc looks valid, we open it and
check the date stamp against one of those stat's.

You would be adding an open(), a read of the full file, and compute a
hash -- to every import of a .pyc.


-1

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/