On Sat, 5 May 2018 at 10:41 Eric Fahlgren <ericfahlgren@gmail.com> wrote:
On Sat, May 5, 2018 at 10:30 AM, Toshio Kuratomi <a.badger@gmail.com> wrote:
On Fri, May 4, 2018, 7:00 PM Nathaniel Smith <njs@pobox.com> wrote:
What are the obstacles to including "preloaded" objects in regular .pyc files, so that everyone can take advantage of this without rebuilding the interpreter?
Would this make .pyc files arch specific?
Or have parallel "pyh" (Python "heap") files, that are architecture specific...
.pyc files have tags to specify details about them (e.g. were they compiled with -OO), so this isn't an "all or nothing" option, nor does it require a different file extension. There just needs to be an appropriate finder that knows how to recognize a .pyc file with the appropriate tag that can be used, and then a loader that knows how to read that .pyc.
(But that would cost more stat calls.)
Nope, we actually cache directory contents so file lookup existence is essentially free (this is why importlib.invalidate_caches() exists specifically to work around when the timestamp is too coarse for a directory content mutation). -Brett