In a good majority of cases, the C you write will be faster than the Assembly you write |
mov %eax, %ecx; and $1, %ecx; shr $1, %eax; mul $2, %eax; or $1, %eax; add %ecx, %eax; |
inc %eax; |
LB wrote: |
---|
Consider a compiler so advanced, it could take an program you give it and alter the structure of the program, the algorithms, even the language used and the language features utilized so as to make the program as efficient as possible. Current compilers have been slowly moving from being very dumb to being very smart, but they're nowhere near this smart. So, for current-day practical purposes, the language does matter to some extent. However, when I say the language doesn't matter, I'm talking theory - about the way things could be in decades to come. |