Как я ускорил dependency injection в Python в 130 раз: от рефлексии до компиляции графа

«Контейнер для DI — это лишний оверхед, передай зависимость руками и не выдумывай». Я тоже так считал, пока не замерил: наивный контейнер резолвил типичный сервис-граф примерно в 200 раз медленнее ручной сборки. Рассказываю, как тремя шагами — кэш плана, удаление проверки, которая всё равно не срабатывает, и компиляция графа в одну плоскую функцию — довёл резолв с 52.9 до 0.40 мкс/оп, почти как руками. И как при этом не дал exec-кодогенерации тихо собирать не те объекты в проде. Приёмы переносимые: профилирование микрооверхеда, выкидывание мёртвой защиты, фаззинг на эквивалентность. Читать разбор

https://habr.com/ru/articles/1048184/

#python #оптимизация_производительности #профилирование #dependency_injection #метапрограммирование #кодогенерация #бенчмарк #cpython

Как я ускорил dependency injection в Python в 130 раз: от рефлексии до компиляции графа

Про DI в Python вечно всплывает один и тот же спор: контейнер — это лишний оверхед, протащи зависимость в конструктор руками и не выдумывай. Звучит логично, я и сам так долго считал. Но логично — не...

Хабр

Out now: Python 3.14.6 and 3.13.14!

A day late to include a last-minute OpenSSL release in the installers. Thanks to @standupmaths for the help with the release notes :)

https://discuss.python.org/t/python-3-14-6-and-3-13-14-are-now-available/107714
#Python #CPython #Python314 #Python313 #release

Python 3.14.6 and 3.13.14 are now available!

A day late, a dollar short an OpenSSL release ahead[1], we have two new Python bugfix releases! Python 3.14.6 Python 3.14.6 is the sixth maintenance release of 3.14, containing around 179 bugfixes, build improvements and documentation changes since 3.14.5. Python 3.13.14 Python 3.13.14 is the fourteenth maintenance release of 3.13, containing around 240 bugfixes, build improvements and documentation changes since 3.13.13. More resources Online documentation PEP 745, 3.14 Release Schedule ...

Discussions on Python.org

@schenklklopfer Huh, interesting.

cPython 3.12.3:
9475.86 MB/s

PyPy (nightly, default settings):
4378.93 MB/s

PyPy (nightly, --jit off):
3676.98 MB/s

My guess: Most of the time is spent in bytes.find(), which is a highly optimized C function in #cPython already. The actual python overhead is so small that my parser even beats #rust (emmett-core) in this benchmark. #PyPy does not have much room for its #JIT to do anything, and seems to have a less optimized stdlib?

Poezio

slixmpp

Day 2 of PyCon Italia 2026 has started! ☕🐍

After a social evening that ended a little later than planned, we're back in the keynote room this morning with Diego Russo talking about the evolution of CPython performance.

It's always a pleasure to see friends from the Python community on stage, especially when the topic is how Python itself keeps getting faster release after release.

A strong start to the second day of the conference. 🚀

#PyConItalia #Python #CPython #PyCon

@mgorny You're welcome?

We don't usually do RCs for patch releases, the last one was five years ago. The 3.14.5 RC was specifically for the GC change.

Unfortunately timelines were a bit short because I wanted to get this out, but it took a bit of time to prepare and test the patches and I didn't want to rush that, nor release during PyCon US.
https://discuss.python.org/t/reverting-the-incremental-gc-in-python-3-14-and-3-15/107014
#Python #CPython

Reverting the incremental GC in Python 3.14 and 3.15

Python 3.14 shipped with a new incremental garbage collector. However, we’ve had a number of reports of significant memory pressure in production environments. We’ve decided to revert it in both 3.14 and 3.15, and go back to the generational GC from 3.13. 3.15 is still in alpha, so such changes are fine. For 3.14, it is unusual for a patch release, but the old GC is a known quantity, the new incremental GC didn’t go through the PEP process, and was rolled back just before the final release of ...

Discussions on Python.org

Always appreciate how people release RCs to give others opportunity to test their changes early, then release final versions before the fixes for "breaks #Portage" kind of regressions introduced in the RCs are merged.

https://github.com/python/cpython/issues/149527

#Gentoo #Python #CPython

`OSError: AF_UNIX path too long` regression in `forkserver` · Issue #149527 · python/cpython

Bug report Bug description: Since fd81246 (in 3.14 as e590f00), we're seeing Gentoo Portage randomly fail with: Traceback (most recent call last): File "/usr/lib/portage/python3.14/ebuild-ipc.py", ...

GitHub

Pushing Python to its limits? “How Python’s Heart Stays Safe at Full Speed” digs into how the core runtime stays fast without sacrificing safety.

Read More: https://zalt.me/blog/2026/05/python-heart-safety-speed

#Python #CPython #programming #softwaredesign

Inspired by @hugovk 's Bluesky Python core devs starter pack, I created one for Mastodon(.social): https://mastodon.social/collections/116540107831540575

A very new feature, and as such quite limited. If I've missed anyone on mastodon.social please let me know! If you're on another instance, I'm afraid I can't add you yet :'-(

#cpython #python #foss