3 ms·
I’m trying to imagine a situation where the risk is worth the performance payoff, but where I’m still writing python.
by monochromatic 9y ago
I’m trying to imagine a situation where the risk is worth the performance payoff, but where I’m still writing python.
- alangpierce 9y agoI think succinctness/laziness is the bigger reason you might want to avoid locking when writing multi-threaded Python code, not performance. If you're just writing to a global variable or an object attribute, it's nice to be able to coordinate that between threads without any additional ceremony. Ideally you wouldn't need to think about it, so it's annoying that it's nearly true but not quite fully true for Python.
- cjhanks 9y agoIn my experience... when you're dealing with external descriptors or programs where CPython releases the GIL on low-level operations which might be contended by multiple threads.
- static_noise 9y agoIt's also about using multithreading to achieve a responsive user interface. Something that is not quite as easy in python with the global interpreter lock which tends to lock up quite some time on seemingly innocent operations.