Author cykerway
Recipients barry, cykerway, methane, ncoghlan, ronaldoussoren, terry.reedy, vstinner
Date 2018-08-08.18:17:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533752269.77.0.56676864532.issue34296@psf.upfronthosting.co.za>
In-reply-to
Content
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?

----

A few more words about my original vision: I was hoping to speed up python script execution using template VMs in which a list of selected modules are preloaded. For example, if you have one script for regex matching, and another for dir listing, then you can create 2 template VMs with `re` and `os` modules preloaded, respectively. The template VMs run as system service so that you can always fork from them to create something like a runtime version of *virtualenv* where only relevant modules are loaded. The preloaded modules can be standard modules or user modules. I don't really see what makes a difference here if the module is standard or not.

----

>   In particular Windows which doesn't have "fork" behaviour.

Forking helps the parent process keep a clean state since it basically does nothing after the fork. If the system doesn't natively support fork then the parent process can do the job by itself instead of forking a child process to do so. But additional work might be needed to remove the artifacts resulting from the execution of user script.
History
Date User Action Args
2018-08-08 18:17:49cykerwaysetrecipients: + cykerway, barry, terry.reedy, ronaldoussoren, ncoghlan, vstinner, methane
2018-08-08 18:17:49cykerwaysetmessageid: <1533752269.77.0.56676864532.issue34296@psf.upfronthosting.co.za>
2018-08-08 18:17:49cykerwaylinkissue34296 messages
2018-08-08 18:17:49cykerwaycreate