跳到正文
研踪PaperTrail
← 研踪 PaperTrail

arXiv:2609.02753 · v3

The Import Tax: A Longitudinal Measurement of Startup Cost in the Python Ecosystem

首次提交 2026-09-02 23:55
版本更新 2026-11-11 22:58
雷达观测 2026-11-13 14:16
arXiv ↗PDF ↗

摘要

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), 66,816 cells in all, with targeted experiments that isolate individual effects. Values are for macOS (Linux in parentheses). Import cost is heavily skewed (median 12.3 ms, 99th percentile 400 ms). Among packages that import in more than 2 ms, namespace distributions excluded, the median package spends 68% of its import time in the standard library (68% on Linux with the interpreter on local storage, 79% on network storage). Precompiling bytecode removes almost all of the cold-start penalty on Linux and 92% of it for the median package on macOS, but only a third of the summed macOS penalty: packages with native libraries pay a security assessment of each library that the system has not seen before, again in every fresh environment. A package's own import code grows by a median 4.0% (5.0%) per year; installing each release with the dependencies of its time changes its trend by a median of only 0.15 (0.35) percentage points (CPython 3.9). CPython 3.14 runs package code faster than 3.9 but imports more and slower standard-library modules, a net 1.16x (1.07x) slowdown. Submodules that dependents import beyond the top level add nothing for the median package and at most 11.7 (49.5) ms for nine packages in ten. On CPython 3.15, global lazy mode cuts the imports that dependents perform to 0.41x (0.39x) of their cost, and 38 of 461 packages fail under it, many only on first use of a name. Harness, code, and dataset are public.

作者备注:23 pages, 6 figures, 2 tables. v3: second revision (storage control for the Linux platform, CPython 3.15.2 lazy mode measured on dependents' import sets, repeated macOS first-load sessions, absolute hidden cost, paired dependency-drift estimates). Dataset and code: https://doi.org/10.5281/zenodo.23300555

AI 论文解读

基于摘要 · 非全文审阅

此版本尚未生成 AI 解读。解读由后台任务生成并按论文版本保存,登录后共享已有结果。

版本差异

本站首次收录为 v3,暂无更早版本可对照。

观测到的版本

相邻记录可能跳过中间版本;首次发现 v2 及以上也会标为版本更新。

v3 · 2026-11-11 22:58 · 最新观测版本

The Import Tax: A Longitudinal Measurement of Startup Cost in the Python Ecosystem

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), 66,816 cells in all, with targeted experiments that isolate individual effects. Values are for macOS (Linux in parentheses). Import cost is heavily skewed (median 12.3 ms, 99th percentile 400 ms). Among packages that import in more than 2 ms, namespace distributions excluded, the median package spends 68% of its import time in the standard library (68% on Linux with the interpreter on local storage, 79% on network storage). Precompiling bytecode removes almost all of the cold-start penalty on Linux and 92% of it for the median package on macOS, but only a third of the summed macOS penalty: packages with native libraries pay a security assessment of each library that the system has not seen before, again in every fresh environment. A package's own import code grows by a median 4.0% (5.0%) per year; installing each release with the dependencies of its time changes its trend by a median of only 0.15 (0.35) percentage points (CPython 3.9). CPython 3.14 runs package code faster than 3.9 but imports more and slower standard-library modules, a net 1.16x (1.07x) slowdown. Submodules that dependents import beyond the top level add nothing for the median package and at most 11.7 (49.5) ms for nine packages in ten. On CPython 3.15, global lazy mode cuts the imports that dependents perform to 0.41x (0.39x) of their cost, and 38 of 461 packages fail under it, many only on first use of a name. Harness, code, and dataset are public.

查看此版本解读 →查看此版本原文 ↗