News for hackers. Stuff that matters.
Re:Why Python Is Slow: Looking Under the Hood by dagw on Tuesday November 18, 2014 @04:09PM (#8626367)
Is it just me who sees a large chunk of these as flaws in the Python implementation as opposed to the Python language?

There are a number of design decision in python language that makes it inherently hard to write a fast python implementation.

Re:Why Python Is Slow: Looking Under the Hood by Animats on Tuesday November 18, 2014 @04:55PM (#8626614)
Ah, the right answer!

There are lots of languages where variables are dynamically typed that can be compiled and optimized with a JIT compiler. In Python, though, any code can mess with any data, using "setattr". You can find all the variables in another module and mess with them at run time, using their names as strings. At compile time, the compiler can't detect that's going to happen.

This is sometimes called the Guido von Rossum Memorial Boat Anchor.

So Python implementations usually have to assume the worst case. Google's attempt at a faster, compatible Python, "Unladen Swallow", was an embarrassing failure. PyPy manages to get past that, but at a huge cost in JIT compiler complexity. After 12 years of work, PyPy is finally shipping stable versions and starting to get some use. It's been all uphill for the PyPy developers, though.

It's kind of sad. Python never achieved its full potential because of the speed problem. Google ended up developing Go because Python was too slow.

Re:Why Python Is Slow: Looking Under the Hood by nostrademons on Wednesday November 19, 2014 @02:04AM (#8628657)
Google ended up developing Go because C++ was too hard to use, not because Python was too slow. The initial target market for Go was C++ programmers - it's only once it was exposed to the Internet that they found out there were more Python programmers interested in a faster Python than C++ programmers interested in an easier C++.
Re:Why Python Is Slow: Looking Under the Hood by adamtj on Tuesday November 18, 2014 @05:19PM (#8626753)
How is python substantially different from javascript in this case? Google has a crazy fast javascript JIT compiler, even though javascript has something equivalent to python's setattr().
Re:Why Python Is Slow: Looking Under the Hood by masklinn on Tuesday November 18, 2014 @05:44PM (#8626874)
> even though javascript has something equivalent to python's setattr().

Python provides significantly more hooks into the behaviour of arbitrary objects, and arguably provides more flexibility than JS.

Here are a few notes from Mike Pall (LuaJIT) on Python features making a straight interpreter slower, and the language harder to optimise (JIT tightly): http://lua-users.org/lists/lua-l/2004-11/msg00083.html

Animats is full of shit, the ability to add arbitrary "static" attributes to existing objects is really not the main problem.

Re:Why Python Is Slow: Looking Under the Hood by masklinn on Tuesday November 18, 2014 @04:55PM (#8626615)
He said "a large number of" though, not "all".