INADA Naoki <songofaca...@gmail.com> added the comment:

On Thu, Aug 9, 2018 at 3:17 AM Cyker Way <rep...@bugs.python.org> wrote:
>
> Cyker Way <cyker...@gmail.com> 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 
> <https://source.android.com/devices/tech/dalvik/configure>:
>
> >   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
else:
    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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34296>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to