Python programs pay for their imports at every process start, a cost that is invisible in steady-state benchmarks but dominant for command-line tools, test workers, and serverless cold starts. Python 3.15 adds explicit lazy imports (PEP 810) on largely anecdotal evidence. We measure the import cost of the 500 most-downloaded PyPI packages, every quarterly release since mid-2021, under six CPython versions (3.9-3.14) on two platforms (Apple M5/macOS and Intel Xeon/Linux): all 66,816 package-version-interpreter cells, plus the release histories of 65 distributions beneath shared namespaces, and targeted experiments that isolate individual effects. Import cost is heavily skewed (median 12.3 ms, 99th percentile 400 ms on macOS). For the median package, 68-79% of import time is spent importing the standard library, while third-party dependencies are the largest component in the slowest decile. The cold first import is almost entirely bytecode compilation on Linux, but on macOS 67% of the cold penalty remains when bytecode is precompiled: we trace it to the operating system's security assessment of each new native library, which every fresh environment pays again. A package's own import code grows by a median 4.0-5.0% per year; resolving dependencies as of each release raises the median trend of the total from 1.8% to 3.0-3.4% per year. CPython 3.14 executes package code faster than 3.9 but imports more and slower standard-library modules, a net 1.16x slowdown on macOS and 1.07x on Linux. What dependents actually import from a package costs a median 1.0x its top-level import but 10.9-13.4x at the 90th percentile. Global lazy mode makes import statements essentially free and breaks 10 packages. Harness, analysis code, and dataset are public.


翻译:暂无翻译

0
下载
关闭预览

相关内容

【干货书】数值Python计算,Numerical Python,709页pdf
专知会员服务
116+阅读 · 2021年5月30日
【干货书】面向计算科学和工程的Python导论,167页pdf
专知会员服务
42+阅读 · 2021年4月7日
专知会员服务
53+阅读 · 2020年9月2日
Python计算导论,560页pdf,Introduction to Computing Using Python
专知会员服务
77+阅读 · 2020年5月5日
【干货书】流畅Python,766页pdf,中英文版
专知会员服务
229+阅读 · 2020年3月22日
【新书】Python中的经典计算机科学问题,224页pdf
专知会员服务
149+阅读 · 2019年12月28日
【新书】Python编程基础,669页pdf
专知会员服务
199+阅读 · 2019年10月10日
爆红GitHub!有人打算用这个项目100天拿下Python
程序猿
16+阅读 · 2019年5月15日
利用动态深度学习预测金融时间序列基于Python
量化投资与机器学习
18+阅读 · 2018年10月30日
荐书丨Python数据分析从入门到精通
程序人生
19+阅读 · 2018年3月31日
福利 | 当Python遇上大数据与机器学习,入门so easy!
用Python制作3D动画
Python程序员
30+阅读 · 2018年1月17日
Python 书单:从入门到……
Linux中国
41+阅读 · 2017年8月6日
国家自然科学基金
2+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
最新内容
俄罗斯如何拦截乌克兰无人机与巡航导弹
专知会员服务
8+阅读 · 10月15日
《武器-目标分配问题:精确与近似求解算法》
专知会员服务
11+阅读 · 10月15日
综述|谁来改进机器人?迈向物理递归自我改进
专知会员服务
10+阅读 · 10月14日
软件定义无人机蜂群给防空带来全新压力
专知会员服务
10+阅读 · 10月13日
《半自主无人地面战车的互操作性》66页
专知会员服务
14+阅读 · 10月13日
相关VIP内容
【干货书】数值Python计算,Numerical Python,709页pdf
专知会员服务
116+阅读 · 2021年5月30日
【干货书】面向计算科学和工程的Python导论,167页pdf
专知会员服务
42+阅读 · 2021年4月7日
专知会员服务
53+阅读 · 2020年9月2日
Python计算导论,560页pdf,Introduction to Computing Using Python
专知会员服务
77+阅读 · 2020年5月5日
【干货书】流畅Python,766页pdf,中英文版
专知会员服务
229+阅读 · 2020年3月22日
【新书】Python中的经典计算机科学问题,224页pdf
专知会员服务
149+阅读 · 2019年12月28日
【新书】Python编程基础,669页pdf
专知会员服务
199+阅读 · 2019年10月10日
相关资讯
爆红GitHub!有人打算用这个项目100天拿下Python
程序猿
16+阅读 · 2019年5月15日
利用动态深度学习预测金融时间序列基于Python
量化投资与机器学习
18+阅读 · 2018年10月30日
荐书丨Python数据分析从入门到精通
程序人生
19+阅读 · 2018年3月31日
福利 | 当Python遇上大数据与机器学习,入门so easy!
用Python制作3D动画
Python程序员
30+阅读 · 2018年1月17日
Python 书单:从入门到……
Linux中国
41+阅读 · 2017年8月6日
相关基金
国家自然科学基金
2+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员