Live data from Hacker News

Why Python, Ruby, and Javascript are Slow

speakerdeck.com

21–30 of 203 posts

Re: Why Python, Ruby, and Javascript are Slow

#21
post #8
post #5

Earlier quoted context omitted.

Have you considered reading the fucking presentation before snarking out on it?

What makes you think I didn't? The author seems to agree with me. He even concludes that we should improve the implementation rather than the language for optimisation.

Which makes your comment useless and redundant. The very point of the presentation pretty much being "this declaration makes no sense"

Re: Why Python, Ruby, and Javascript are Slow

#22
This is misleading and contains errors like calling C++ "C". Unless you have a great deal of knowledge about these things already, I urge you not to learn from this but read the slides purely for entertainment.

Question: The author claims to be a compiler author. After some digging I haven't found any information on what compilers he has written or are part of writing. Could someone point me to the compiler(s) Alex is involved with? Thanks.

Re: Why Python, Ruby, and Javascript are Slow

#23

This is misleading and contains errors like calling C++ "C". Unless you have a great deal of knowledge about these things already, I urge you not to learn from this but read the slides purely for entertainment. Question: The author claims to be a compiler author. After some digging I haven't found any information on what compilers he has written or are part of writing. Could someone point me to the compiler(s) Alex i…

Look up PyPy.

Re: Why Python, Ruby, and Javascript are Slow

#25

Meh, MEH. I'm almost never waiting on my python code. I'm waiting on network or disk or database or joe to check in his changes or etc. I'm sure there are people who do wait. But that's why numpy, c extensions, all the pypy, psycho, and similar things exist. Python and more broadly "scripting" languages are for speed of development. Something else can take on speed of execution faster than 90% of people need it to be…

It's not an unresolved question whether idiomatic Python is slower than idiomatic C/C++ for solving comparable problems. Python is much, much slower than C.

Re: Why Python, Ruby, and Javascript are Slow

#27
post #4

Kind of a poorly-named deck. It's really about why programs use features of these languages that end up causing poor performance relative to C, rather than why the individual VMs themselves are slow. It's no surprise that trading the byte-precision of C for the convenience of a garbage collector and heap-allocated data structures results in a performance decrease. Dynamically-typed languages are often easier to progr…

Did you read the deck? The GC isn't the problem; it's layout and management of allocations that's the problem, whether you use a garbage collector or explicit deallocation to clean up the resulting mess.

I think the idea that GC is what slows down dynamic languages has to be the most prevalent misconception about language performance.

Re: Why Python, Ruby, and Javascript are Slow

#28

This is misleading and contains errors like calling C++ "C". Unless you have a great deal of knowledge about these things already, I urge you not to learn from this but read the slides purely for entertainment. Question: The author claims to be a compiler author. After some digging I haven't found any information on what compilers he has written or are part of writing. Could someone point me to the compiler(s) Alex i…

I've been a C/C++ programmer since ~1993 and apart from wondering why he had to "look up" a C hash table (there's one in K&R) I saw nothing to complain about.

Re: Why Python, Ruby, and Javascript are Slow

#29
post #14
post #10

Earlier quoted context omitted.

If the deck is to be believed, it's not the garbage collector or the heap that's causing the performance loss, it's that APIs and algorithms they enable are allocation-heavy compared to other "faster" languages. Heap allocations are expensive even in non-GC languages.

The first example is lookup based on name, you can get away from that in python with slots but the common consensus is that it's not worth the performance improvement. That somehow translates into a dogma like, "Never use slots," but sometimes it is worth it.

> The first example is lookup based on name, you can get away from that in python with slots

You can get away from that with a sufficiently smart JIT turning a stable access to a known object into little more than a vtable dispatch. That's close to what V8 does with hidden classes on full cache hits (object map — its "hidden class" — + object "array" property both cached).

    point.x
will generate the assembly:

    cmp [ebx,],
    jne 
    mov eax,[ebx, ]
(where ebx is the previously loaded `point`)

Re: Why Python, Ruby, and Javascript are Slow

#30
post #8
post #5

Earlier quoted context omitted.

Have you considered reading the fucking presentation before snarking out on it?

What makes you think I didn't? The author seems to agree with me. He even concludes that we should improve the implementation rather than the language for optimisation.

I didn't get that from the presentation at all. What I read is a guy complaining that idiomatic Python is necessarily slow because it depends, for its clarity and terseness, on not controlling allocations or memory layout, and that Python- the- language abets the problem by having its standard library build on the same idiom.
Post reply on HN