Hacker News new | past | comments | ask | show | jobs | submit login
Python Preloaded – Bundle Python executable with preloaded modules (github.com/albertz)
3 points by albertzeyer on Oct 9, 2022 | hide | past | favorite | 1 comment



Problem:

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.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: