Re: asm grep
- From: Frank Kotler <fbkotler@xxxxxxxxxxx>
- Date: Sun, 30 Dec 2007 02:23:20 GMT
Rod Pemberton wrote:
"Frank Kotler" <fbkotler@xxxxxxxxxxx> wrote in message
news:Xpwdj.3630$tK5.681@xxxxxxxxxxx
The problem arises in that, in order to minimize checking "obvious
non-matches", I scasb for the first character of "needle", completely
ignoring "lines" (find the beginning/end of the line in which the match
was found only after finding a match). Seems to me this isn't going to
work if we want to print non-matching lines...
If you support LF, CRLF, but not CR, then scasb backwards for LF, i.e., 3
times for -B 2...
Okay, okay, I'll read the friendly man page... (Holy Crap!) Yes, well... no "context" is supported in the asmutils version... Seems like it might be a useful thing. Yeah, we can find a match first, and get "context" in either direction. That's not a problem. I guess if we're in inverse-matching mode, we can find a match first, and then print from "[last_printed]" to the match... and update "[last_printed]"... may not be the roadblock I first thought...
*or* report line-number
where a match is found, instead of "offset" (which seems useful to me).
Same might work here... without losing too much speed when we *don't* need to print/count non-matching lines... Have to think about this...
It's probably easier to implement with a small loop now that you want to
track more than one item, especially since tracking multiple character
values doesn't fit well with single x86 instructions... I.e., you have a
trade-off between functionality vs. speed vs. size.
Definitely! Without functionality, we can make it *real* small and *real* fast! :) We need it to work a *little* like "real grep", at least. Question is, how cheap can we get it...
What's the point? (a non-rhetorical question) If this is to be the "contest" between C and asm to prove "Asm Rulz", we need *all* the functionality of "real grep" - or more - *and* to beat it for speed (size probably won't be a problem). I really didn't intend to enter that contest, I just noticed a little "lint" in the asmutils grep... Then I happened to notice that it was dog-slow... I've convinced myself that I can "improve" the asmutils grep - much faster and, with the *same* functionality, little if any bigger. If I'm *gonna* try to improve the asmutils grep, by how much and in what way? I have no idea.
Best,
Frank
.
- Follow-Ups:
- Re: asm grep
- From: Herbert Kleebauer
- Re: asm grep
- References:
- asm grep
- From: Frank Kotler
- Re: asm grep
- From: Robert Redelmeier
- Re: asm grep
- From: Frank Kotler
- Re: asm grep
- From: Robert Redelmeier
- Re: asm grep
- From: Charles Crayne
- Re: asm grep
- From: Frank Kotler
- Re: asm grep
- From: Robert Redelmeier
- Re: asm grep
- From: Charles Crayne
- Re: asm grep
- From: Robert Redelmeier
- Re: asm grep
- From: Frank Kotler
- Re: asm grep
- From: Robert Redelmeier
- Re: asm grep
- From: Frank Kotler
- Re: asm grep
- From: Rod Pemberton
- asm grep
- Prev by Date: Re: asm grep
- Next by Date: Re: When a computer start
- Previous by thread: Re: asm grep
- Next by thread: Re: asm grep
- Index(es):