3 ms·
Exactly. There are a lot of well-designed dynamically typed languages which beat the slow four (python, php, perl, ruby) by a large factor. You are talking abou
by rurban 9y ago
Exactly. There are a lot of well-designed dynamically typed languages which beat the slow four (python, php, perl, ruby) by a large factor. You are talking about unboxing, but most fast dynamic languages rather have properly tagged primitives. Unboxing is not that performant as starting properly from scratch.
For comparison e.g. php has now proper unboxing optimizations, perl6 also. But the properly tagged primitives such as in Chez scheme, Common Lisp, SELF, Javascript, lua or luajit (to cite the fastest) beat these by at least a factor of 10.
Next problem is refcounting, as you can also easily observe with php7. Getting rid of most local refcounting madness led to a speedup of 100%. A proper GC leads to smaller data, faster updates and memory safety and leakfree-ness.
Next false fact in this article: "Python is interpreted rather than compiled".
Nope, cpython has a proper compiler. It translates the AST (a tree) to a linearized list with relative jumps and pretty tight ops and lot of compiler optimizations. Much better than the primitive ad-hoc AST interpreters of php or perl, which still carry around absolute ptrs all over in its ops.
The problem with the python bytecode is that is still too big, compared to the fast bytecode interpreters.
He probably meant "Python doesn't compile to native code, only bytecode". But there the speedup would be max. 2x, not 10-100 as observed with python. So this argument is bogus.
3. "Python's object model can lead to inefficient memory access" Yes, of course. There's no type optimization done. Which should be trivial and the first thing to do. But more importantly is the design of the hook system. E.g. let's compare it to Common Lisp, where you also can redefine any function/class/object or native data structure access on the fly or Javascript which is similar extremely dynamic. These systems have lots of optimizations for the fast general case, but python not. It generally turns down such optimizations.
- deleted 9y ago[deleted]