I haven't expected that DI can cost so much
I haven't expected that DI can cost so much
A bar chart comparing performance in Requests Per Second (RPS) between 'TaskGroup' (purple bars) and 'Await' (orange bars) based on the number of dependencies ('Num Deps'). For 1 dependency, TaskGroup achieves 4604 RPS and Await achieves 4628 RPS. For 2 dependencies, TaskGroup is at 4085 RPS while Await is at 4558 RPS. For 4 dependencies, TaskGroup drops to 3817 RPS, whereas Await maintains 4529 RPS, showing that Await scales better as dependency count increases.
Quick perf test: changed #LiteStar dependency resolution from TaskGroup to await.
RPS impact? Minimal vs 17% degradation with TaskGroup at 4 deps. Each request does 4 DB calls.
TaskGroup overhead matters more than expected.
More details in thread 👇
#Python #Backend
My #PyCon RU 2025 talk (Best Speaker award! 🏆) is now on YouTube: youtu.be/MpQgrhLO6aE
English subtitles available! 🇬🇧
I break down the Dependency Inversion Principle, compare popular #Python #DI frameworks, and show why they matter for building better applications.
This Blogpost covers some of the reasons my lab switched to #julialang
Many are left out, e.g. we simply call any python library/function we don't have in Julia, from Julia! (e.g..mne, scopy etc.). Native GPU made easy. Extending other libraries without editing them etc
slicker.me/julia/julia_...
A bar chart titled "LiteStar" showing Request Per Second (RPS) performance across different numbers of dependencies (0 to 5). The RPS drops from 41,451 with 1 dependency to 26,492 with 2 dependencies. A red arrow points to this 36% decrease with a handwritten caption asking "Why?".
Is #LiteStar faster than #FastAPI? Benchmarks say yes, but look at Dependency Injection. 📉
Adding just 2 flat dependencies significantly degrades the throughput. I dug into the source to find why.
Thread: TaskGroups, Kahn's algorithm & performance trade-offs. 🧵
#Python #Backend #WebDev
The memes are funny, the situation is scary 🤭