This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients barry, cykerway, methane, ncoghlan, ronaldoussoren, terry.reedy, vstinner
Date 2018-08-09.03:08:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
On Thu, Aug 9, 2018 at 3:17 AM Cyker Way <> wrote:
> Cyker Way <> added the comment:
> I'm fine with stdlib, 3rd party tools, or whatever. My focus is to understand is whether this idea can be correctly implemented on the python VM or not. I've been searching for similar implementations on standard JVM, but the results mostly come from research projects rather than industrial solutions. That being said, Android does have preloading implemented in its Dalvik/ART VM (which is more or less a variant of JVM). Cited from <>:
> >   The preloaded classes list is a list of classes the zygote will initialize on startup. This saves each app from having to run these class initializers separately, allowing them to start up faster and share pages in memory.
> I was wondering what makes it difficult for standard JVM (eg. HotSpot) to have such feature and why Dalvik/ART is able to do it, and what would be the case for the python VM?

Many WSGI servers provides "pre-fork" for (1) faster worker process creation and
(2) sharing static memory.  So it's definitely possible.

When compared with JVM, Python is dynamic language.
for example,

if not os.environ.get('XXX_NO_SPEEDUP'):
    from xxx._speedup import somefunc  # Load somefunc from extension
    from xxx._util import somefunc  # Load somefunc from pure Python

Environment variables, configuration files, or even input from keyboard or
some sensors may affects importing modules, unlike JVM.

So more strict restriction is required for application in Python's case.
It can't be used for general, blindly and automatically from VM-side.
It should be implemented explicitly from Application side.
Date User Action Args
2018-08-09 03:08:55methanesetrecipients: + methane, barry, terry.reedy, ronaldoussoren, ncoghlan, vstinner, cykerway
2018-08-09 03:08:55methanelinkissue34296 messages
2018-08-09 03:08:54methanecreate