[Python-Dev] PEP 3147: PYC Repository Directories
rrr at ronadam.com
Mon Feb 8 06:28:46 CET 2010
Barry Warsaw wrote:
> On Jan 31, 2010, at 01:06 PM, Ron Adam wrote:
>> With a single cache directory, we could have an option to force writing
>> bytecode to a desired location. That might be useful on it's own for
>> creating runtime bytecode only installations for installers.
> One important reason for wanting to keep the bytecode cache files colocated
> with the source files is that I want to be able to continue to manipulate
> $PYTHONPATH to control how Python finds its modules. With a single
> system-wide cache directory that won't be easy. E.g. $PYTHONPATH might be
> hacked to find the source file you expect, but how would that interact with
> how Python finds its cache files? I'm strongly in favor of keeping the cache
> files as close to the source they were generated from as possible.
Yes, I agree, after thinking about it, it does seems like it may be more
complex than I first thought.
I think the folder-per-folder option sounds like the best default option at
this time. It reduces folder clutter for the python developer and may
loosen the link between source files and byte code files just enough that
it will be easier to experiment with more flexible modes later.
It seems to me that in the long run, (probably no time soon), it might be
nice to even do away with on disk byte code altogether unless it's
explicitly asked for. As computers get faster, the time it takes to compile
byte code may become a smaller and smaller percent of the total run time.
That is unless the size of python programs increase at the same rate or faster.
To tell the truth in most cases I hardly notice the extra time the first
run takes compared to later runs with the precompiled byte code. Yes it
may be a few seconds at start up, but after that it's usually not a big
part of the execution time. Hmmm, I wonder if there's a threshold in file
size where it really doesn't make a significant difference?
More information about the Python-Dev