arXiv cs.AI· Peng Ding, Rick Stevens·· 3 天前AI 评分36
LLM 辅助零依赖 Python 库:stdlib 与第三方库的性能和正确性对比
Stdlib or Third-Party? Empirical Performance and Correctness of LLM-Assisted Zero-Dependency Python Libraries
AI 导读
研究用 44 个仅依赖标准库的单文件 Python 模块(zerodep)对比参考库,发现多数场景下 stdlib 实现性能相当(2x 以内),部分因架构开销反而快 5x-115x,但图像处理、二进制序列化、底层加密等依赖 C 扩展的计算存在明显性能悬崖。
正文 · 原文
Abstract:Third-party Python libraries introduce dependency-management overhead, supply-chain risk, and deployment friction. We study when eliminating a dependency preserves enough correctness and performance to justify the gains in footprint, deployability, and trust surface. Our testbed is zerodep, 44 single-file, stdlib-only Python modules spanning 12 categories, each benchmarked against its reference library.
Three performance regimes emerge. Stdlib-only implementations achieve parity (within 2x) in the majority of cases; many outperform their references by 5x-115x where architectural overhead dominates; and a clear cliff appears for C-extension-backed computation (image processing, binary serialization, low-level crypto), confirmed by PyPy JIT and profiling experiments. Beyond speed, stdlib modules reduce installed footprint by orders of magnitude (median 31 KB vs. 700 KB), import 2.2x faster, and eliminate 88 transitive dependencies maintained by 128 distinct PyPI accounts.
Analysis of the LLM-assisted development process across all 44 modules shows that specification completeness, not model capability, is a strong predictor of generation success, and that contract-linked review reduces review volume by 5x while eliminating compatibility regressions. Together, these results turn dependency elimination from an anecdotal coding style into an evidence-based engineering tradeoff.
| Comments: | 17 pages |
| Subjects: | Software Engineering (cs.SE); Artificial Intelligence (cs.AI); Programming Languages (cs.PL) |
| Cite as: | arXiv:2605.21405 [cs.SE] |
| (or arXiv:2605.21405v2 [cs.SE] for this version) | |
| https://doi.org/10.48550/arXiv.2605.21405 arXiv-issued DOI via DataCite |
Submission history
From: Peng Ding [view email]
[v1]
Wed, 20 May 2026 17:02:54 UTC (34 KB)
[v2]
Tue, 13 Oct 2026 08:27:49 UTC (76 KB)
来源:arXiv cs.AI · arxiv.org