logoalt Hacker News

oguz-ismail2yesterday at 2:03 PM2 repliesview on HN

So assembly is the slowest language?


Replies

hmryyesterday at 2:24 PM

Depends. If it takes an assembly programmer 8 hours to implement <X>, can an equally proficient Python programmer spending 8 hours to implement <X> create a faster program?

Let's say they only need 2 hours to get the <X> to work, and can use the remaining 6 hours for optimizing. Can 6 hours of optimizing a Python program make it faster than the assembly program?

The answer isn't obvious, and certainly depends on the specific <X>. I can imagine various <X> where even unlimited time spent optimizing Python code won't produce faster results than the assembly code, unless you drop into C/C++/Zig/Rust/D and write a native Python extension (and of course, at that point you're not comparing against Python, but that native language).

IshKebabyesterday at 8:05 PM

Maybe it's best to think of it as an effort-performance graph. For a given amount of effort what performance do you get?

Assembly is going to give you pretty great performance generally, but the line only starts when you get to "ridiculous effort"!