Re: [OT] Sed and Awk

From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 12/15/03


Date: Mon, 15 Dec 2003 19:58:57 GMT

On Mon, 15 Dec 2003 05:59:04 -0600, Ed Morton <morton@lsupcaemnt.com> wrote:
>

<snip>
>> Speed, replacing HL code with ASM where something is done countless times,
>> is the only practical application using *your* rather mercenary definition
>> of the word.
>
> But I already said "assuming that code runs fast enough to satisfy your
> requirements" and "that runs fast enough" so speed isn't a reason I was
> looking for. If your code runs fast enough to satisfy your requirements,
> there's no point in optimizing it at the expense of
> readability/maintainability and time-to-market.
>
> Even after re-reading it a couple of times, I honestly don't think my
> definition was particularly mercenary - what about it appears mercenary
> to you?
>

Just seemed that way. Because of the terms you used, like "time-to-market".

>> If one was into having the smallest and fastest and most efficient and glitch-
>> free binaries, including leaving out the compiler and the libs necessary to
>> make it work, then ASM would be the way to go.
>
> Not sure what you mean by "glitch-free binaries", but if you mean
> bug-free, then I doubt if you'll have fewer bugs in hand-written
> assembly than in compiler-generated assenmbly code. I spent several
> years studying quality metrics and, unless you take heroic measures in
> code inspection, etc. (see
> http://www.fastcompany.com/online/06/writestuff.html for what that
> means!) the more code you write by hand the more bugs you have.
>

With ASM you can write code perfectly optomized for the exact cpu you
are dealing with. C et al write to "virtual cpu's".

> I will accept your and Charles Demas's other point, though, that
> sometimes you just have to do it for size. I've never come across that
> and I'm surprised to hear it's a real problem, but I'll bow to your
> collective experiences.
>

Better bow to Charles', not mine. Both you guys are way beyond me. I am
just parroting things I've read and running them past my superiors in
these arcane arts.

>> You'd have to be into the art of it I guess, and art is always more expensive
>> than assembly-line products, one way or another.
>>
>> ASM is supposed to be very handy for de-bugging too.
>
> Having had to debug programs written in M68000 assembly, I couldn't
> agree less. Unless you mean that knowing assembly is handy for
> debugging a suspected compiler bug? I could buy that, though any time
> I've suspected a compiler bug (it couldn't be a bug in MY code ;-)),
> I've been proven wrong without having to resort to wading through the
> assembly.
>

Yes. For compiler bugs.

> One other use for a knowledge of assembly - I have read the assembly
> code generated from C code to see how best to generate my C code (from
> one of the higher-level languages I mentioned) for a specific
> compiler+platform to produce the fastest assembly code (obvious one:
> switches on contiguous ranges are faster than nested "if-else"s,
> non-obvious is that switches on non-contiguous ranges generated exactly
> the same assembly as nested ifs from my target compiler). Again, though,
> it isn't necessary to write the assembly by hand to do that, just to
> understand what the C you write implies for the assembly on that target
> compiler+platform.
>

Makes sense.

> Hmmm, seems like we've wandered just a tad OT from sed vs awk. Ah well,
> the whole thread was labelled OT so I probably don't need to add a
> second OT to the subject line...
>

Thank you Ed.

Who do you think will win the World Series?

:-)

AC



Relevant Pages

  • new codegen thoughts...
    ... C was parsed into an XML-based AST; ... the ASM was assembled and linked. ... compiler frontend to the codegen to make this work). ... CPU registers will be mapped to the tvars behind the scenes (the AST ...
    (comp.compilers)
  • optimizers are overrated
    ... I started learning ASM not long ago to improve my understanding of the ... The first function uses a typical C style loop to ... which one is more efficient all you guys would reply "the compiler will most ... so my "write C like ASM" optimization worked. ...
    (comp.lang.c)
  • Re: Hiring Advice
    ... I still need to know ASM or at least know how to read ... what the Compiler does to figure out what went wrong. ... If, instead, you stuff all your globals into a struct, then the compiled code only fetches the base address from the constant pool once, then uses the free constant offset to get to the individual parts. ... And so the idea that you can get away without any ability to work at the assembly level is worrisome, and that the schools seem to be teaching it now as a given even more so. ...
    (comp.arch.embedded)
  • Re: Hiring Advice
    ... Ability to work in assembly for at least one processor preferred. ... I still need to know ASM or at least know how to read ... what the Compiler does to figure out what went wrong. ... If, instead, you stuff all your globals ...
    (comp.arch.embedded)
  • XML-based object orientated pre-Assembler
    ... I have been promising an object orientated ASM IDE for a while now. ... Trying to make the best of what is already here, I have made a compiler, ... that will parse XML code and output ASM files. ...
    (alt.lang.asm)