Hacker News new | ask | show | jobs
by jarel 5000 days ago
> I will tell you how it can be - if the JavaScript engine JITs the JS in a more optimized way than the C compiler compiled the C.

Yes. Exactly. Let's say there are two languages A and B, and A is compiled (be it JIT or AOT) by a smarter compiler, resulting in faster code than the same program written in language B, how does that not make language A faster?

I do know that comparing interpreted/JITed code and AOT-compiled code is somewhat nonsensical, but then again, so is talking about "faster" and "slower" languages.

1 comments

>Yes. Exactly. Let's say there are two languages A and B, and A is compiled (be it JIT or AOT) by a smarter compiler, resulting in faster code than the same program written in language B, how does that not make language A faster?

Well I am talking about the performance limitations imposed by the laws of physics. Not which compiler is better. I can always find a better or worse C or JS compiler/JITter so that proves nothing.

Doing more (Which a more highly abstracted languages must do) in less time with all else being the same is not possible as we understand quantum physics today.

> Doing more (Which a more highly abstracted languages must do)

Can you explain why you think this assumption is true? I don't think it is.

A higher level of abstraction may allow your to convey more information in less code, but that does not mean it necessarily translates to more machine code.

In fact, when you operate on a higher level of abstraction with more information available, the compiler may even have more freedom to produce highly efficient output without breaking expected semantics.

Wow.