<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <div class="moz-cite-prefix">On 07/21/2017 03:28 PM, Barry Warsaw
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20170721182804.492a8ab8@presto">
      <pre wrap="">The TPI (Terrible Python Idea) I had at Pycon was some kind of (local)
memcached of imported Python modules, which would theoretically allow avoiding
loading the modules from the file system on start up.

There would be all kinds of problems with this (i.e. putting the "terrible" in
TPI), such as having to deal with module import side-effects, but perhaps
those could be handled by enough APIs and engineering.
</pre>
    </blockquote>
    <br>
    This would be taking a page out of PHP's book.<br>
    <br>
    PHP--or at least, PHP ten years ago--doesn't have the equivalent of
    .pyc files.  If you have mod_php running inside Apache with no other
    extensions, it literally tokenizes each .php script every time it's
    invoked.<br>
    <br>
    To solve this performance problem, someone wrote the "Alternative
    PHP Cache" (or "APC"), which runs <i>in Apache</i>.  (Yep, it's not
    usable outside Apache!)  APC stores the tokenized versions of PHP
    scripts in something approximating their actual in-memory
    representation.  To use something stored in the cache, you'd iterate
    over all the variables/functions, copy each one into your local
    interpreter instance, and perform fixups on all the pointers to
    convert them from relative to absolute addresses.<br>
    <blockquote><a class="moz-txt-link-freetext" href="http://php.net/manual/en/book.apc.php">http://php.net/manual/en/book.apc.php</a><br>
    </blockquote>
    <br>
    I note that the introduction to APC says:<br>
    <blockquote>Warning<br>
      This extension is considered unmaintained and dead. However, the
      source code for this extension is still available within PECL.<br>
    </blockquote>
    So perhaps the PHP folks have moved on from this technique.<br>
    <br>
    <br>
    <i>/arry</i><br>
  </body>
</html>