Hi Eric, On 12/06/2020 4:17 pm, Eric Snow wrote:
On Fri, Jun 12, 2020 at 2:49 AM Mark Shannon <mark@hotpy.org> wrote:
The overhead largely comes from what you do with the process. The additional cost of starting a new interpreter is the same regardless of whether it is in the same process or not.
FWIW, there's more to it than that:
* there is some overhead to starting the runtime and main interpreter that does not apply to additional in-process interpreters
You seem to be implying that there would be more overhead for a new interpreter that operates in a different O/S process. What would that be?
* I don't see why we shouldn't be able to come up with a strategy for interpreter startup that does not involve copying or sharing a lot of interpreter state, thus reducing startup time and memory consumption
Indeed, that would be beneficial regardless of which process the interpreter is in.
* I'm guessing that re-importing builtin/extension modules is faster than importing then new in a separate process
Each new interpreter need to re-import the modules. The overhead could be reduced by making more of the module immutable, allowing some sharing. For linux, at least, that benefit would apply to multiple processes as well. Cheers, Mark.