3 ms·
Sorry if I keep responding, but there's a lot of interesting points in your question. > Like how the JVM assumes classes are final and removes virtual calls un
by fatbird 10y ago
Sorry if I keep responding, but there's a lot of interesting points in your question.
> Like how the JVM assumes classes are final and removes virtual calls until it first sees a subclass.
AFAIK, the python VM doesn't do any JITting at all. A runtime decision in the VM about handling locks is impossible at this point, I think.
- chrisseaton 10y agoWell the user space locks he discusses already read a variable and branch between uncontended and contended cases. Specialising speculatively for single threaded would just be a third cannot-be-contended case. But yes it'd work better with a JIT - yet another reason to write one.
- dbcurtis 10y agoThere is a version of Python that JITs -- I forget it's name at the moment, though.
- anateus 10y agoPyPy
- smortaz 10y agothere are several. we (microsoft) are also trying to get an api into cpython so that anyone can use to build JITs for python. our sample implementation is at: https://github.com/Microsoft/Pyjion https://github.com/Microsoft/Pyjion pycon 2016 talk: https://www.youtube.com/watch?v=1DAIzO3QXcA https://www.youtube.com/watch?v=1DAIzO3QXcA
- ori_b 10y agoSort of. if (threads) lock(...); should still be pretty quite a bit faster than fine grained locks everywhere, since your atomics aren't broadcasting and shooting down cache lines everywhere.