fuzzyman at voidspace.org.uk
Sun Feb 28 13:32:31 CET 2010
On 28 Feb 2010, at 12:19, Floris Bruynooghe
<floris.bruynooghe at gmail.com> wrote:
> On Sun, Feb 28, 2010 at 02:51:16PM +1300, Greg Ewing wrote:
>> Floris Bruynooghe wrote:
>>> (But even then I'm not
>>> convinced that would double the stat calls for normal users, only
>>> those who only ship .pyc files)
>> It would increase the number of stat calls for normal
>> users by 50%. You would need to look for a .pyc in the
>> source directory, then .py in the source directory and
>> .pyc in the cache directory. That's compared to two
>> stat calls currently, for .py and .pyc.
> Can't it look for a .py file in the source directory first (1st stat)?
> When it's there check for the .pyc in the cache directory (2nd stat,
> magic number encoded in filename), if it's not check for .pyc in the
> source directory (2nd stat + read for magic number check). Or am I
> missing a subtlety?
The problem is doing this little dance for every path on sys.path.
>> A solution might be to look for the presence of the
>> cache directory, and only look for a .pyc in the source
>> directory if there is no cache directory. Testing for
>> the cache directory would only have to be done once
>> per package and the result remembered, so it would
>> add very little overhead.
> That would work too, but I don't understand yet why the .pyc check in
> the source directory can't be done last.
> Debian GNU/Linux -- The Power of Freedom
> www.debian.org | www.gnu.org | www.kernel.org
> Python-Dev mailing list
> Python-Dev at python.org
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
More information about the Python-Dev