Jeethu Rao - Faster Python startup
904 views · Published 6 September 2018 · 27:56 · Indexed 20 September 2026
Channel: EuroPython Conference · 2018 · Science & Technology
Faster Python startup [EuroPython 2018 - Talk - 2018-07-27 - Smarkets] [Edinburgh, UK] By Jeethu Rao The cPython’s startup speed generally quite fast compared to other similar dynamic language interpreters. Despite this, the interpreter’s startup time increases linearly with the number and size of imported python modules. Although interpreter startup speed isn't a significant concern in long running servers, it does matter for the command line and other frequently launched applications. One of the oldest tricks in the book, when it comes to performance optimizations is to perform frequent and expensive operations fewer times and reuse results from previous invocations. We noticed that the overhead of reading and un-marshalling .pyc files at startup can be eliminated if we could directly embed code objects and their associated object graph from .pyc files into the data segment of the cPython binary. This technique is quite similar to the approach taken by image based languages like Smalltalk in the past. Implementing this for cPython is made simpler because marshaled code objects in .pyc files contain a subset of the types of objects that marshal format supports. With this approach, loading a module included in the python binary is as cheap as dereferencing a pointer, albeit at the cost of increased binary size. This talk will discuss the approach taken to implement the aforementioned idea for Python 3.6 and the challenges faced in implementing it. It will also talk about benchmark results from the improvements and possible future directions for this work. Although this talk delves into cPython internals, no prior experience with cPython internals is required to follow along. License: This video is licensed under the CC BY-NC-SA 3.0 license: https://creativecommons.org/licenses/by-nc-sa/3.0/ Please see our speaker release agreement for details: https://ep2018.europython.eu/en/speaker-release-agreement/
More from this channel
-
33:42
Managing the cloud with libcloud
-
39:57
Precompiling and deploying Python to any Linux, Mac OS X or FreeBSD system
-
1:15:34
Openstack Overview - Operational Detail of a large Python Project
-
56:26
Clone detection in python
-
20:17
Tarashish Mishra - Building Realtime Web Applications with WebRTC and Python
-
39:52
Thierry Carrez/Doug Hellmann - How OpenStack makes Python better (and vice-versa)
-
41:04
Honza Král - Log all the things!
-
29:39
Hugues Lerebours, Renaud Bauvin - Inspect (Or Gadget)