Minecraft

Pages: 1234
Apr 19, 2014 at 9:39pm
In a good majority of cases, the C you write will be faster than the Assembly you write
And as I have written before, codechef shows that you have to know how to efficiently write C code to beat C++ in large projects.

I will show you example of handwritten code working slower than generated. I will use assembly because it is just a mnemonic for machine language and it is easier to understand what happens when you see mul instead of F6

Ok. we have a value in eax and we need to increment it.
Handwritten code:
mov %eax, %ecx;
and $1,   %ecx;
shr $1,   %eax;
mul $2,   %eax;
or  $1,   %eax;
add %ecx, %eax;
Code generated by Java JIT compiler:
inc %eax;
Guess what will be faster?
Apr 19, 2014 at 10:01pm
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.
Well, I was actually replying to Bobby, but yes, I agree with you. Although I think when talking about compilers etc. it's better to talk about practical possibilities by default.
Apr 20, 2014 at 12:23am
closed account (N36fSL3A)
I'm 100 percent sure that any modern PC doesn't have pistons moving inside of it. I don't think computers ever had pistons moving inside it to be honest.

Just me being off topic.
Apr 20, 2014 at 12:34am
http://en.wikipedia.org/wiki/Analytical_engine

Minecraft computers might involve pistons as components.
Topic archived. No new replies allowed.
Pages: 1234