On Sat, Sep 22, 2007 at 11:34:15AM -0600, Dave Smith wrote: > Charles Curley wrote: > >You are correct that a register declaration is advisory. I agree that > >one would have to look at the assembler output. Actually, what I would > >do if I were writing this for a real embedded library is look at the > >assembler output for several of these versions, pick one or two for > >size and speed, and further hand optimize the heck out of that. > > > > You mean you wouldn't test it to see if it's fast enough as is before > launching into a possibly very expensive assembler optimization session? > Even in the smallest of embedded systems, premature optimization is the > still the root of all evil. :) And remember, C is usually pretty > portable, whereas assembler optimizations are almost always not.
All valid points, of course. I should have qualified that with something like, "If I needed further optimization...." But, as Levi pointed out, this sort of thing is rarely a bottleneck in embedded stuff. > And lastly, even on the smallest of embedded systems I've worked on > (32Kb code space, 20Mhz CPU clock), I still have never had to do any > hand ASM optimization. Sheesh, such luxury, almost enough room to swing a cat. I've worked on 65xx single chip derivatives with as little as 4K ROM, 1K RAM (of which only 256 bytes are available for stack), and 1 MHz clock. Come to think of it, those are the specs of the Apple I. I've done hand optimization for speed and ROM space. The 65xx family does not really lend itself to C or Forth because those languages both "think" in terms of 16 bit data (think PDP-11 assembler and you have C pretty well). So those processors are often candidates for hand optimization. Then there's the RCA Cosmac 1802 series processors. <Shudder/>. The Rockwell PPS series, with clock speeds measured in kilohertz. <Scream/> -- Charles Curley /"\ ASCII Ribbon Campaign Looking for fine software \ / Respect for open standards and/or writing? X No HTML/RTF in email http://www.charlescurley.com / \ No M$ Word docs in email Key fingerprint = CE5C 6645 A45A 64E4 94C0 809C FFF6 4C48 4ECD DFDB
pgpJbKTp4vrro.pgp
Description: PGP signature
/* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
