Re: asm grep
- From: "Rod Pemberton" <do_not_have@xxxxxxxxxxxxx>
- Date: Wed, 26 Dec 2007 16:25:26 -0500
"Frank Kotler" <fbkotler@xxxxxxxxxxx> wrote in message
news:Wyxcj.13312$_o6.11673@xxxxxxxxxxx
Okay. Are you optimizing for size or for speed?
Er, more sanity... Okay, okay, faster... :-) Is there any point in using
a small assembly grep that's slower than a bloated C grep?
I haven't checked but I'd guess that my suggestions are an (almost) equal
trade. You eliminate a few push/pop sequences and branches and replace them
with rep'd string instructions...
My guess is that as you try to get the code to be smaller, you
(counterintuitively) have to add more logic, push/pop sequences, memory
operand instructions, and longer byte sequence instructions (more CISC-like)
to compensate for the increasing amount of work required per instruction.
The way out is a mix of a 1) simple short algorithm, 2) smaller equivalent
byte sequence instructions (size), 3) the most powerful instructions (more
bytes per instruction, but reduces total quantity of instructions and bytes
used), and 4) shortcuts, corner cutting, quick'n'dirty code. I.e., the goal
for size is to do as much work per byte as possible. Work per byte has to
be a 1/x function, right? Since you're using Linux OS calls, 4) use OS
calls which do much work and have few args. You'd especially want to look
for powerful OS calls which aren't used or well used by the C compiler
(i.e., advantage assembly).
It doesn't. We ASSume that it is clear on program startup (have you ever:)
seen this *not* be true?). We aren't going to tolerate all that bloat!!!
Never checked... I try to make sure my code has control. But, since it's
for Linux, I didn't know if it was (re)set in the Linux executable startup
or Boldyshev's "system.inc". By "have you ever...", I'll take it you meant
the former.
Thanks for the feedback, Rod. I don't know if it's worth "massaging"
this code - for small, fast, or full-featured - but it's interesting to
think about... and serves as an example that asm isn't always faster!
Except for the almost obsolete floppy bootdisk, I have no need for small
size anymore... I like fast programs especially for searching.
Rod Pemberton
.
- References:
- asm grep
- From: Frank Kotler
- Re: asm grep
- From: Rod Pemberton
- Re: asm grep
- From: Frank Kotler
- asm grep
- Prev by Date: Re: When a computer start
- Next by Date: Re: Which assembler (or compiler) to start with? (newbie question)
- Previous by thread: Re: asm grep
- Next by thread: Re: asm grep
- Index(es):
Relevant Pages
|