Reducing Python's startup time
Reducing Python's startup time
Posted Aug 18, 2017 15:19 UTC (Fri) by ehiggs (subscriber, #90713)Parent article: Reducing Python's startup time
Startup time in Python on a busy NFS device or parallel filesystem (GPFS, Lustre, etc) is particularly painful. If you strace the startup you can watch it stat hundreds of files. If you start using pkg_resources, where it needs to crawl the filesystem to see what's available, then it goes to the thousands or tens of thousands depending on the size of the project and this results in a startup time in minutes on HPC systems.
$ strace -c -e open,stat python3 -c "import numpy; import pkg_resources; print('hello')" hello % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 100.00 0.000006 0 1193 129 stat 0.00 0.000000 0 451 2 open ------ ----------- ----------- --------- --------- ---------------- 100.00 0.000006 1644 131 totalYou would think that zipapp[1] fixes this by putting all the files into a single zipped executable, but last time I checked it only zips the application being distributed and not the dependencies.
[1] https://docs.python.org/3/library/zipapp.html
Posted Aug 19, 2017 9:01 UTC (Sat)
by gebi (guest, #59940)
[Link]
it creates a single executable including your python code and all dependencies.
Posted Aug 21, 2017 16:35 UTC (Mon)
by epa (subscriber, #39769)
[Link] (1 responses)
Posted Aug 21, 2017 19:50 UTC (Mon)
by njs (subscriber, #40338)
[Link]
Reducing Python's startup time
Reducing Python's startup time
Reducing Python's startup time