arXiv:cs.AI· Peng Ding, Rick Stevens·· 22 小时前
标准库还是第三方库?LLM 辅助零依赖 Python 库的性能与正确性实证研究
Stdlib or Third-Party? Empirical Performance and Correctness of LLM-Assisted Zero-Dependency Python Libraries
AI 导读
一项针对 zerodep 的实证研究显示,LLM 辅助生成的 44 个纯标准库 Python 模块在多数场景下性能可与参考库持平(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