Re: asm grep




"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

.



Relevant Pages

  • Page fault question (zero-filling)
    ... specific questions as they pertain to the linux kernel. ... I have been exploring optimizing code under linux, ... Am I missing some more important role for this zero-filling? ... The fast zeroing uses mmx instructions, ...
    (comp.arch)
  • Re: Page fault question (zero-filling)
    ... > specific questions as they pertain to the linux kernel. ... > The fast zeroing uses mmx instructions, whereby the slow interrupt uses ... it doesn't use MMX instructions). ... the Linux kernel *could* be altered to save and restore the ...
    (comp.arch)
  • Re: Trouble with clock
    ... that you're running the Linux kernel in an environment where its ... Virtual PC uses just-in-time compilation to translate Intel x86 ... instructions to PowerPC instructions. ... As a result, your Linux ...
    (microsoft.public.mac.virtualpc)
  • Re: How do I install this missing library?
    ... >> These were the instructions I was talking about. ... > libg2c is part of gcc. ... > FORTRAN enabled gcc package: ... maybe you can recommend a quick Linux guide? ...
    (comp.os.linux.misc)
  • Re: Re: Re: Re: Attn: leen.meyer Are you still around? Still want to try vga=ask
    ... > know how in Linux. ... enter and just follow the onscreen instructions. ... Once the install is complete (it might have to compile a new module so just ... Don`t forget when using sax that you need to choose which resolutions you ...
    (alt.os.linux.suse)