4 ms·
It was common belief in that era that you made code faster by making it longer and more complicated. The opposite is true now (because of cache size and deep Oo
by astrange 5y ago
It was common belief in that era that you made code faster by making it longer and more complicated. The opposite is true now (because of cache size and deep OoO) - simple predictable loops are great - but even then people tended to overdo it.
Of course, it's a way worse problem that they compiled at -O0.
- AussieWog93 5y ago>Of course, it's a way worse problem that they compiled at -O0. There was a Modern Vintage Gamer video going into this. Apparently it wasn't a mistake or misunderstanding, but a bug that existed in the original version of the compiler that caused issues when compiled with optimisation. Even then, the main library that did most of the heavy lifting was compiled with o2. Super Mario 64 was a launch title, and they simply didn't have the time to work out the kinks in the compiler to get those few extra fps in Dire Dire Docks.
- ReactiveJelly 5y agoYeah it's hard to remember the time before you could get 2 near-perfect C/C++ compilers on the 5-ish most popular architectures. And the architectures have consolidated since then.
- pcwalton 5y agoAs I recall, that MVG video was incorrect—Nintendo could have compiled with optimizations and the game would have worked. The most plausible explanation to me (and, IIRC, the one that Giles Goddard speculated was the case) is that they simply didn't want to take the chance that optimization could surface unknown bugs in the code, and they knew that the unoptimized version worked and played fine, so they played it safe and shipped the known-good unoptimized version. This is a perfectly understandable decision in terms of risk management, even if in retrospect it was too conservative. Less likely, but still very plausible, was that turning off optimization was just a mistake; mistakes happen when you're rushing a release for a deadline, and build deployment was not as orderly and automated back then as it is today.
- taneq 5y agoSounds like a good call to me. If you have something mission critical that's tried and tested, and reliably does 99% of what you need it to, you don't mess with it. It's very easy in software dev to get caught up in software optimizations, and it's a lot harder to quantify the risk of continuing to mess with something the closer you get to ship date. Of course it "shouldn't make any difference" but who among us hasn't at some point been bitten by a "that couldn't possibly affect... ohhh. Ohhhhhhh." style bug? When you're dealing not just with a single piece of software, but an entire hardware+software ecosystem, you don't risk jeopardizing the whole stack for an extra few FPS in some back corner.
- bombcar 5y agoEspecially in an era where a buggy release could require an expensive return/reprinting step. Back in those days it had to ship as close to perfect as possible because you couldn’t just send out a patch layer.
- 3836293648 5y agoNo, that's not more plausible. Because it's only the NTSC release that was compiled in debug mode. The Japanese and PAL releases were O2
- FartyMcFarter 5y agoBut those are different versions. Just because they worked with -O2 doesn't mean NTSC would. I'm not just saying this in a theoretical sense either; I've seen much weirder bugs.
- throwawaylinux 5y agoIt's always been a mix. Inlining, unrolling, and otherwise choosing longer sequences of instructions that are faster is still a major theme of optimization and optimizing compilers. Even on today's high performance CPUs, which are far more sophisticated than the primitive 5-stage scalar in-order R4300 (not sure it even had any branch prediction actually).
- kimixa 5y ago> Even on today's high performance CPUs, which are far more sophisticated than the primitive 5-stage scalar in-order R4300 (not sure it even had any branch prediction actually). I believe it didn't, with a short scaler pipeline (only 5 stages) the cost of waiting for a conditional branch to be calculated is relatively less, and MIPS of that era actually exposed the idea of a "delay slot" - rather than pausing the pipeline while calculating the jump, it still executed the next few instructions - so they were always executed no matter if the jump was actually taken or not. Filling this with NOPs makes it equivalently the same as a pipeline bubble, but I guess the intention was in some cases it could actually be used for something. I think a few RISC architectures of that era did similar things, their entire goal was simplicity after all, the argument being that something like a branch predictor and the logic required to reverse speculatively executed instructions "should" instead be used to make the CPU smaller or higher performing in the best case (either as implementing better performing but larger logic, or higher frequency due to shorter critical paths). I think this was dropped in later ISAs as it confused a lot of people, it wasn't well used by compilers (which is interesting as much of the MIPS ISA was explicitly designed around what would be easy for a compiler rather than handrolled asm), and improving process technology made transistors to handle the expensive superscaler speculative execution architectures relatively cheaper.