The startup time of CPython including loading big libraries like PyTorch or TensorFlow is too slow. In case of slow file systems, I have seen startup times including such import of 10-20 seconds.
Very simple idea:
Keep the state of CPython right after we imported the big libraries and make it available instantly when needed. When loading the state, we can continue to run any random Python script (we can use runpy).
Currently I implemented this via a fork server. It uses some of the concepts of reptyr. I tested it on Linux and MacOSX, with TensorFlow as an example library.
The startup time of CPython including loading big libraries like PyTorch or TensorFlow is too slow. In case of slow file systems, I have seen startup times including such import of 10-20 seconds.
Very simple idea:
Keep the state of CPython right after we imported the big libraries and make it available instantly when needed. When loading the state, we can continue to run any random Python script (we can use runpy).
Currently I implemented this via a fork server. It uses some of the concepts of reptyr. I tested it on Linux and MacOSX, with TensorFlow as an example library.