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) largely on anecdotal evidence; no systematic measurement of the ecosystem's import cost exists. We present one: the 500 most-downloaded PyPI packages, sampled quarterly over five years of releases, measured under six CPython versions (3.9-3.14) on two platforms (Apple M5/macOS and Intel Xeon/Linux), for 63,431 measurements in total, plus direct measurement of 3.15's global lazy-import mode. Import cost is heavily skewed: half of packages import in under 6 ms, but the 99th percentile is 354 ms, the first import after installation costs 3-22x more (bytecode compilation), and importing a package's submodules costs up to 294x more than the top-level import that benchmarks report. The median package's cost grows only +1.6-2.4%/year, but the mean grows +11-13%/year: growth is concentrated in a heavy tail. Newer interpreters import the same code 1.16x slower on macOS, but not on Linux, and a single point release (3.11.5 vs. 3.11.16) swings cost by 1.34x. Global lazy mode makes import statements essentially free, yet breaks 8 of 414 top packages. Harness and dataset are available on request.


翻译:暂无翻译

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月13日
《半自主无人地面战车的互操作性》66页
专知会员服务
8+阅读 · 10月13日
迈向更智慧的军事情报
专知会员服务
8+阅读 · 10月12日
《美国陆军2026年野战手册 2-0 情报》
专知会员服务
7+阅读 · 10月12日
《基于启发式算法求解武器-目标分配问题》
专知会员服务
8+阅读 · 10月12日
《美陆军最新条令出版物 2-0 情报》
专知会员服务
10+阅读 · 10月10日
电子战测试与训练靶场:战前验证战备状态
专知会员服务
4+阅读 · 10月10日
《美国陆军如何作战》46页最新报告
专知会员服务
11+阅读 · 10月10日
相关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会员