jcallen@Encore.COM (Jerry Callen) (11/12/90)
In article <8658@scolex.sco.COM> seanf@sco.COM (Sean Fagan) writes: >In article <9333@b11.ingr.com> lhughes@b11.ingr.com (Lawrence Hughes) writes: >>Welcome to the wonderful world of multi-megabyte executables that barely fit >>in 2 MB systems, barely crawl on 25 MHz CPUs and won't even run on any known >>diskette system. Compliments of brothers Kernigan and Ritchie. >(It's Kernighan, btw.) > >So, tell me, Larry, why are programs written in C faster than ones written >in assembly? Ah, I love it. Answer one gross generalization with another. I don't know, Sean. Why are they? -- Jerry Callen jcallen@encore.com
seanf@sco.COM (Sean Fagan) (11/13/90)
In article <13218@encore.Encore.COM> jcallen@encore.Com (Jerry Callen) writes: >>So, tell me, Larry, why are programs written in C faster than ones written >>in assembly? >Ah, I love it. Answer one gross generalization with another. Well, actually, I meant, "Why are some programs ..." My statement, as such, means that (i.e., my semantics are correct, but ambiguous, which is the way I meant it to be). >I don't know, Sean. Why are they? I think you can answer that. Here's one example: I have a program here which does lots of stuff (ok, it's a compiler 8-)). The FP-handling stuff was originally written in assembler. With lots of macros. But it was still only 16 bit, because nobody had taken the time to make it 32-bit (why should they? It worked, for the most part, and the '386 will execute 16-bit instructions just fine). However, I needed to change it, because it wasn't quite right under some circumstances. So... I rewrote some of the routines in C. End result? The C version was faster (because I could change algorithms more easily, and take advantage of letting the compiler optimize away), more correct, and smaller. So, there's one program in which the C version if faster than the assembly. ``But,'' you say, ``that's because the assembly version was poorly written!'' Yep. And because it was written in assembler, and the original authors were nowhere near, it was impossible to deal with. The C version, on the other hand, is written very clearly, with meaningful comments. I have changed the basic design of the routine three times now, because of efficiency or correctness reasons, and it's never taken me longer than a day or so to do so. If you really want to hear why you should program in C (or any other HLL) instead of assembly, talk to Henry Spencer, Doug Gwyn, or Chris Torek: they can all explain it better than I can (having had much more practice), and I don't particularly feel like being polite about such a thing. -- -----------------+ Sean Eric Fagan | "*Never* knock on Death's door: ring the bell and seanf@sco.COM | run away! Death hates that!" uunet!sco!seanf | -- Dr. Mike Stratford (Matt Frewer, "Doctor, Doctor") (408) 458-1422 | Any opinions expressed are my own, not my employers'.