gh-134939: Add a Multiple Interpreters Howto Doc by ericsnowcurrently · Pull Request #136143 · python/cpython
Some users might need a (foot)note that subinterpreters can sometimes improve the startup by importing nothing.
example
def non_stateless(): non_stateless if __name__ == '__main__': import threading from concurrent import interpreters interps = [interpreters.create() for i in range(10)] threads = [ threading.Thread(target=interp.call, args=(non_stateless,)) for interp in interps ] for thread in threads: thread.start() for thread in threads: thread.join()
That seems not so beneficial for the InterpreterPoolExecutor case, though.