[Python-Dev] A fast startup patch (was: Python startup time)
On Sat, 5 May 2018 at 10:41 Eric Fahlgren <ericfahlgren at gmail.com> wrote:
> On Sat, May 5, 2018 at 10:30 AM, Toshio Kuratomi <a.badger at gmail.com>
>> On Fri, May 4, 2018, 7:00 PM Nathaniel Smith <njs at 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
>> Would this make .pyc files arch specific?
> Or have parallel "pyh" (Python "heap") files, that are architecture
.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).
-------------- next part --------------
An HTML attachment was scrubbed...