(no title)
omh1280 | 7 months ago
Python asyncio can really screw up your runtime performance if you use it poorly. And it's _really_ easy to use poorly.
Consider a FastAPI server using asyncio instead of threading. _Any_ time you drop down into a synchrononous API, you better be sure that you're not doing anything slow. For example, encoding or decoding JSON in Python actually grabs the GIL depending on what library you're using, and then you have no hope of releasing control back to asyncio.
kccqzy|7 months ago
bb88|7 months ago
Trying to combine mental models of asyncio and threading is a model for pure insanity.
deathanatos|7 months ago
kevmo314|7 months ago
I think a lot of people assume you can slap `async` onto the function signature and it will not block anything anymore. I've had PRs come through that literally added `async` to a completely synchronous function with that misunderstanding.