Python 3.15의 lazy import로 CLI 시작 속도 4배 향상, 그러나 모든 곳에서 효과 본 건 아니다

Adopting Python 3.15's lazy imports: a 4× faster CLI, and where they didn't help

Python 3.15의 lazy import로 CLI 시작 속도 4배 향상, 그러나 모든 곳에서 효과 본 건 아니다

Python 3.15.2로 백오피스를 옮긴 뒤 PEP 810의 명시적 lazy import를 도입해 CLI의 --help 실행 시간을 1,314ms에서 326ms로 약 4배 단축했다. Meta의 정적 분석기 Lifeguard를 게이트로 삼아 import 시점 부작용을 검증하고, 테스트에서는 lazy 문을 즉시 로딩으로 바꿔 패치 동작을 보존했다. 다만 TUI는 20%, MCP 서버는 15% 개선에 그쳤는데, 남은 비용 대부분이 Textual과 FastMCP 자체에서 비롯됐기 때문이다.

The CLI's `--help` became four times faster. It no longer loads DuckDB, Jinja2, markdown-it, PyYAML, httpx2 or rcssmin, and a subprocess test pins that list, so an import that brings one back fails the suite.

이 날의 다른 글

2026-11-18