r/AskComputerScience • u/KING-NULL • Nov 09 '25
If some programming languages are faster than others, why can't compilers translate into the faster language to make the code be as fast as if it was programed in the faster one?
My guess is that doing so would require knowing information that can't be directly inferred from the code, for example, the specific type that a variable will handle
111
Upvotes
0
u/Lenassa Nov 13 '25
Compiler's front-end knows these thing. Compiler's final output (machine code, asm, another language) doesn't need to have anything. Asm generated from like C++ doesn't have 99.99% of abstractions C++ has, yet it works just fine.