HN Hall of Fame Weekly email

Why GNU grep is fast (2010)

lists.freebsd.org Essays & writing Social posts & threads Software engineering Class of 2015-03 Hall of Fame
Screenshot of lists.freebsd.org captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 9 calendar years, with breakout response in 7 of them.

submissions
14
submitters
14
observed span
2010–2022
peak thread · 218 comments
512 pts
latest 20+ return · 2022-07-24
209 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

I tested string searching algorithms a few years ago[0][1], and Brute Force was surprisingly performant, enough that picking a string searching algorithm becomes an engineering tradeoff. It found a sentence fragment at the end of Moby Dick within 8ms, 7 times slower than Boyer-Moore. But most of us aren't searching Moby Dick, but rather a HTTP header, some user input, or a paragraph of a document. Even long-winded users won't write Moby Dick into your <textarea>. Most languages and libraries…

It's probably worth pointing out that OS X is using BSD grep. You will see a phenomenal difference if you install the gnu grep via homebrew: $ homebrew info grep GNU grep, egrep and fgrep https://www.gnu.org/software/grep/ /usr/local/Cellar/grep/3.3 (21 files, 885.3KB) * Poured from bottle on 2019-01-03 at 12:23:37 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/grep.rb ... This is a very arbitrary example, but I've got 1.5Gb application log sitting on my machine right now that'll suffice. I'll…

Twirrim·511-point thread·

If you use grep in OS X, and you use it a lot (even called through other programs/libraries) it pays in time to install GNU grep vs. the default OS X provided one. It's several times faster. Ran into this when benchmarking grep + GNU Parallel on OS X vs. Linux in my thesis (raftlib modeling) work. Results on my small MacPro cluster didn't match those on Linux. The OS X runs were orders of magnitude slower despite almost identical…

jcbeard·417-point thread·

The key to making programs fast is to make them do practically nothing. This is the Ultimate Truth of optimizing computer programs, and it seems so few people understand it. "Why can't you make Python faster!?" Because Python does a lot of stuff without you asking.

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
7

100+ points or 50+ comments

Total points
2997

reference only — not used in Hall rules or ranking

Total comments
860

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2010-08-23Why GNU grep is FastFirst breakout · Best threadgiu512115
2011-03-31Why GNU grep is fastshawndumas32968
2011-08-08Why GNU grep is fastColinWright25343
2013-11-28Why GNU grep is fast (2010)kurren495129
2015-03-05Why GNU grep is fast (2010)Hall inductionbpierre15140
2015-04-27Why GNU grep is fast (2010)dnet315
2015-05-06Why GNU grep is fastMindTwister40
2016-08-24Why GNU grep is fast (2010)mozumder417145
2016-10-27The key to making programs fast is to make them do practically nothing. ;-)rbanffy10
2018-06-08Why is GNU grep so fast?ghosthamlet20
2019-03-29Why GNU grep is fast (2010)jacobedawson511218
2020-07-23Why GNU grep is fast (2010)letientai2997835
2022-01-14Why GNU grep is fastrsecora40
2022-07-24Why GNU grep is fast (2010)Latest 20+ point returnpcr91030320962