Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!ames!ptsfa!ihnp4!cuae2!killer!elg From: elg@killer.UUCP (Eric Green) Newsgroups: comp.misc Subject: Re: Assembly Language Message-ID: <1371@killer.UUCP> Date: Sat, 22-Aug-87 00:55:10 EDT Article-I.D.: killer.1371 Posted: Sat Aug 22 00:55:10 1987 Date-Received: Sun, 23-Aug-87 12:57:54 EDT References: <17981@amdcad.AMD.COM> Organization: Bayou Telecommunications Lines: 44 in article <17981@amdcad.AMD.COM>, tim@amdcad.AMD.COM (Tim Olson) says: > In article <1305@faline.bellcore.com> gtchen@faline.UUCP (George T. Chen) writes: > +----- > |But I'm sure the actual piece of executable code in orders of magnitude > |smaller than the equivalent C program. Also, I've assumed that since you > |did the program in assembly, then it will probably run faster. For that > |matter, any program done in any HLL can be done in assembly and made to > |run as fast if not faster. > +----- > Only if the person writing the assembly language is very good. I must agree, with reservations. Note that my 5,000 lines of assembly language assembles down to 7,000 bytes of 6502 machine code. A "C" compiler for a 6502-based machine is a real porker... for example, a simple 1,000 line text-formatter program (included with my "C" compiler) compiles down to about 25K of machine code. However, when we are talking about real machines, with architectures designed from the start to support high level languages (Chuck Peddle thought his little chip would be used in electronic ovens, fer chrissakes, he had no idea anybody could wrap a COMPUTER around it!), it's a different story. For example, I was unsatisfied with the performance of Jove on the Pyramids at school. So I profiled it, and decided I would re-code the hot-spots into assembly language. Well, to make a long process short, after printing out the .s file and looking at a particular hot spot (the cursor positioning code), there wasn't any darned way under the heavens for me to do much better than the compiler had done... I figured a way of eliminating maybe 5 instructions out of 50, and the resulting code didn't run appreciably faster (still accounted for about the same percentage of CPU). Re-tooling the algorithm so that the full cursor-positioning routine wasn't called for every darned keystroke, would have saved jillions of microseconds more time than hitting this particulr hot spot (alas, Jove is an example of a program that's nigh unreadable... nowhere does he tell the PURPOSE of any particular variable, file, or subroutine, leading to wild guesses as to what he's trying to do). Anyhow, after that, I looked at the output of several small utility programs that I'd written, using various levels of the optimizer. Most of them, I couldn't do a darn bit better by hand (I'm no expert in 90x assembler, but I have written a couple thousand lines in it, so I'm no novice, either). -- Eric Green elg%usl.CSNET Ollie North for President: {cbosgd,ihnp4}!killer!elg A man we can believe (in). Snail Mail P.O. Box 92191 Lafayette, LA 70509 BBS phone #: 318-984-3854 300/1200 baud