2 ms·
Yes... now turn that map into a lock free thread-safe dict in Python and show us the same code. I get that for free in Java via ConcurrentHashMap.
by meddlepal 8y ago
Yes... now turn that map into a lock free thread-safe dict in Python and show us the same code. I get that for free in Java via ConcurrentHashMap.
- ben-schaaf 8y agoIf you mean lock-free as in no GIL, you obviously can't. But otherwise all python code is inherently thread safe.
- meddlepal 8y agoYea I meant lock free and ready for multi-threaded use without a GIL. I didn't mean to dump on Python either, I write a lot of Python and Java but comparisons like yours aren't really fair because the JVM is just considerably more powerful than Python's runtime. I could take a huge list of words, hand subsets to threads and let them all update the same map using the same API and without needing a lock.