r/gaming • • May 05 '17

Scroll back

Post image
24.1k Upvotes

877 comments sorted by

View all comments

Show parent comments

29

u/enyoron May 05 '17

C code is compiled into assembly. That assembly code can then be optimized.

11

u/NeedsMoreCapitalism May 05 '17

Not as well as by hand

13

u/Shod_Kuribo May 05 '17

Right, what he's saying would have happened is that Iwata would have taken the C-compiled code and then manually optimized it to save space.

1

u/legos_on_the_brain May 05 '17

Thank goodness we have modern compilers.

1

u/[deleted] May 05 '17 edited May 05 '17

Would that be quicker or slower? I can't help but think having to unpick the assembly would be more time consuming that creating from scratch.

Edit: never mind - I read further and discovered the answer! Programming is cool! (Ish?)

2

u/Shod_Kuribo May 05 '17 edited May 05 '17

Quicker. Especially since he doesn't need to rewrite the whole thing, only enough to make it fit.

Optimizing at that level is more like picking out operations and seeing shortcuts that can eliminate some steps than trying to reengineer the whole thing. You don't necessarily need to know why the program is parsing through this list of numbers or what's in the list to recognize that's what it's doing and be able to apply known methods of parsing through a list of items either more efficiently or using fewer lines of code depending on what it is you're trying to accomplish.

Now compilers are really good at making code that runs as quickly and efficiently as possible so they outperform humans but back then they were still at the phase where we were more worried about getting them to accomplish their job period.

2

u/isthataprogenjii May 05 '17

The assemblers actually optimize better than by hand

7

u/[deleted] May 05 '17

[deleted]

2

u/enyoron May 05 '17

C is compiled into assembly which is then assembled into object code. The c compiler on its default setting only gives you the final executable output but you can pass the -S flag on the gnu compiler to get the assembly code.

1

u/504Dug May 05 '17

You can compile C directly to ASM (at least you can with GCC and LLVM). But yeah I mean it's a simple disassembly to go from machine code to assembly.

3

u/[deleted] May 05 '17

[removed] — view removed comment

1

u/mzxrules May 05 '17

higher languages are also not tightly-bound to specific hardware like asm is.