3 ms·
A lot of speed critical python especially in the stdlib is already written in C; a JIT will never speed it up. Other code is so dynamic that even an effort comp
by ZiiS 4y ago
A lot of speed critical python especially in the stdlib is already written in C; a JIT will never speed it up. Other code is so dynamic that even an effort comparable to V8 would not help. But if the is some code left which can run twice as fast just because CPython has twice as many lines of code we may need to do that.
- coldtea 4y ago>Other code is so dynamic that even an effort comparable to V8 would not help I hear that a lot, but I find it's bogus. Javascript (especially modern one, after ES6) is extremely dynamic too. And a huge majority of Python code doesn't use much crazy dynamic features - a JIT can detect this and do its magic (V8s Jits detect such "could be dynamic but is static" code with several tricks and optimizes it).
- acmj 4y agoFully agree. The python community just wouldn't admit they lack someone as good as Mike Pall or the V8 team. The python performance in the computer language benchmark games is so embarrassing especially on the benchmarks not requiring external libraries [1]. [1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/python.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- nine_k 4y agoPython is absurdly dynamic, but a JIT normally runs a profiler and discovers which paths are actually taken. If an instance attribute is always directly accessed, and there is no MRO lookup, descriptor / property lookup, getattr lookup, etc, the JIT can optimize it down to the trivial path. If a non-trivial path is rarely taken, it can be run by interpreting the plain bytecode. At least it's how I understand things like V8 work. Smalltalk is also highly dynamic. But it was running so much faster than Java that the Smalltalk's JIT was adopted to speed up Java bytecode. By now Java may rival C speeds with competently written code.