
Faster than grep? Old age and treachery beat youth and skill every time. - gthank
http://ridiculousfish.com/blog/archives/2006/05/30/old-age-and-treachery/
======
jff
I thought the most precious bit was when he imagined the author of grep as
basking in the glow of a dozen xterms. Maybe the author of gnu grep, but not
the author of the True Grep. At least he said vi rather than vim. But, you
see, in the age of 18 year old hackers running Ubuntu and Compiz, such minor
distinctions are just not worth making.

Edit: I'll give the author this much, it was a cute exposition style.

~~~
mhd
"I've seen [visual] editors like that, but I don't feel a need for them. I
don't want to see the state of the file when I'm editing." _\- Ken Thompson
(author of grep)_

(That was a while ago. Apparently he now uses sam)

~~~
brazzy
I have a Unix book from 1984, in which vi is described as "this new editor
which has more features than a normal user would ever want to know about, and
as a consequence is a huge memory hog".

~~~
mhd
Didn't vi come out in '76?

~~~
kragen
It's present in the 3BSD distribution I have from 1979, from tuhs.org. I don't
think any copies of 2BSD survive. I think '76 is about the time Sixth Edition
came out, so I don't think it's likely that vi started that early.

~~~
mhd
I just googled it, and 1976 seems to be the common release date, but without
any references. On this page[1], it says that BSD (1977) had _ex_ , and 2BSD
includes _vi_ , so that would make the first public release 1978.

Considering the age of Unix, calling _vi_ new in 1984 would still make little
sense, but maybe the book mentioned was actually written long before that
date.

[1]: <http://oreilly.com/catalog/opensources/book/kirkmck.html>

------
herf
There was a Linux update to support multi-byte encoded characters many years
ago, so that default grep was suddenly much slower, and setting "LANG=C" would
make grep many, many times faster, since it would work on 8-bit values only.

I'm not sure if this is still the case, or if GNU grep has now optimized this
path.

~~~
nodata
I bug reported that in horror. It's optimised now.

------
viraptor
I can think of a hack that could be faster, but wouldn't be very portable...
Probably won't have the time to try it out though: JIT the `needle` text into
a bunch of dynamically generated functions matching the characters at specific
position, one "miss" (skip len(needle) chars) function and a jump table. Sure
- it will need a `255 x len(needle)` jumptable, but 99% of the addresses will
point at the "miss" case and you don't need that many cache pages if you're
streaming through gigabytes of data. So basically it would be a JIT-unrolled
BM.

It would be a "jumps -vs- mispredicted branches" cost challenge, but I'm not
sure which would win...

------
teilo
I think this page is remarkable just for the background. Very clever CSS hack.

~~~
docgnome
Funny, that's the thing that made me reach for readability. I don't like that
style of design when people put huge titles for their blogs at the top leaving
me momentarily confused as to what I'm looking at, only to realize the content
actually starts further down the page. It was neat, but I don't like it.

~~~
sprout
For me, I tend to read on a high-resolution monitor, a few feet distant from
the thing, so I'm always at high magnification, and image-heavy layouts like
that really bog down the page magnified on a 1900x1200 screen.

------
sshconnection
I couldn't get the line "I'm sick and tired of your kung fu treachery!" from
Black Dynamite out of my head the whole time I was reading this.

------
jacquesm
Search for 'taller one' for a really funny comment.

