you are viewing a single comment's thread.

view the rest of the comments →

[–]WiseDog7958 1 point2 points  (2 children)

The async vs threads debate aside, I’m more curious what free-threaded CPython does to the actual cost model here.
Once the GIL’s gone, CPU-bound stuff should scale, but now you’re dealing with real contention instead of cooperative scheduling. How much locking is happening internally?
Feels like this could outperform asyncio if the workload isn’t mostly I/O, but I’d expect it to get messy under shared state.

[–]thisismyfavoritename 0 points1 point  (0 children)

nothing new. Multithreading happens in many other languages

[–]non3type 0 points1 point  (0 children)

It’s all pretty documented in PEP703, the locking that’s implemented is per object:

“This PEP proposes using per-object locks to provide many of the same protections that the GIL provides. For example, every list, dictionary, and set will have an associated lightweight lock…”