[Python-ideas] Why CPython is still behind in performance for some widely used patterns ?
cs at cskk.id.au
Fri Jan 26 19:20:23 EST 2018
On 26Jan2018 20:59, Soni L. <fakedme+py at gmail.com> wrote:
>On 2018-01-26 08:18 PM, Chris Barker wrote:
>>If there are robust and simple optimizations that can be added to
>>CPython, great, but:
>> This mail is the consequence of a true story, a story where CPython
>>at least those last three are statically compiled languages -- they
>>are going to be faster than Python for this sort of thing --
>>particularly for code written in a non-pythonic style...
>Java and C#? Statically compiled? Haha.
>Java has a bytecode. While yes, Java doesn't need to compile your code
>before running it, the compilation time in CPython is usually minimal,
>unless you're using eval. You can precompile your python into bytecode
>but it's usually not worth it. Java can also load bytecode at runtime
>and do bytecode manipulation stuff.
>The only "real" benefit of Java is that object layout is pretty much
>static. (This can be simulated with __slots__ I think? idk.) See also,
>(The same goes for C#. Idk about Go.)
However, both Java and Go are staticly typed; I think C# is too, but don't
know. The compiler has full knowledge of the types of almost every symbol, and
can write machine optimal code for operations (even though the initial machine
is the JVM for Java - I gather the JVM bytecode is also type annotated, so JITs
can in turn do a far better job at making machine optimal machine code when
This isn't really an option for "pure" Python.
Cameron Simpson <cs at cskk.id.au> (formerly cs at zip.com.au)
More information about the Python-ideas