Wait... ack is faster than grep?

81 views
Skip to first unread message

Jay Levitt

unread,
Aug 29, 2008, 4:09:39 PM8/29/08
to ack dev/users
I love ack. It's easy, it's convenient, the output is attractive, and
it skips over my svn directories. It's so nice to use, I don't even
mind that it's slower than grep.

Only... I saw this benchmark today:

http://blog.i-no.de/archives/2008/05/06/index.html

and apparently, for everyone else but me, ack is WAY FASTER. On my
mail server, which has an Athlon X2, FC9, x86_64, perl 5.10.0, ack
1.86:

[root@micro]~# echo $LANG
en_US.UTF-8
[root@micro]~# ll -h /tmp/biggerlog
-rw-r--r-- 1 root root 173M 2008-08-29 15:45 /tmp/biggerlog
[root@micro]~# time ack --noenv duffy /tmp/biggerlog > /dev/null
ack --noenv duffy /tmp/biggerlog > /dev/null 3.49s user 0.21s system
99% cpu 3.713 total
[root@micro]~# time grep duffy /tmp/biggerlog > /dev/null
grep duffy /tmp/biggerlog > /dev/null 0.39s user 0.25s system 99% cpu
0.646 total

and...

[root@micro]~# export LANG=C
[root@micro]~# time ack --noenv duffy /tmp/biggerlog > /dev/null
ack --noenv duffy /tmp/biggerlog > /dev/null 3.12s user 0.19s system
99% cpu 3.315 total
[root@micro]~# time grep duffy /tmp/biggerlog > /dev/null
grep duffy /tmp/biggerlog > /dev/null 0.39s user 0.26s system 99% cpu
0.651 total

I see similar results on my Mac Pro (Xeon 8-way 3.2GHZ, OS X 10.5.4,
perl 5.8.8). They have no heritage in common, other than me. I know
very little Perl, but dprofpp -r shows that ~97% of the time is,
unsurprisingly, spent in App::Ack::search. What could be different
about my systems? Are there any better standardized benchmarks?

Sitaram Chamarty

unread,
Aug 29, 2008, 10:22:55 PM8/29/08
to ack-...@googlegroups.com
On Sat, Aug 30, 2008 at 1:39 AM, Jay Levitt <jay+...@jay.fm> wrote:

> http://blog.i-no.de/archives/2008/05/06/index.html

Interesting...

> and apparently, for everyone else but me, ack is WAY FASTER. On my

if it's any comfort, ack has never felt faster when doing simple
searches on single files (ie, not using the "smarts" to ignore some
types of files etc). I just did a test run on a 215 MB file, and ack
takes 2.3 seconds to greps 0.32. (Cache is hot; I made sure)

I thought most of it was perl's startup cost, but when I ran the same
search with all the log files in that directory (totalling approx 420
MB), > mail server, which has an Athlon X2, FC9, x86_64, perl 5.10.0,
ack still takes 4.0 seconds to greps 0.6. (This is a 2-GB RAM
machine, and the cache was hot -- you can't churn though 400 MB in 0.6
seconds on any normal disk that I know of...)

so... someone with more ack knowledge needs to tell us what we are
doing wrong, if any

Sitaram Chamarty

unread,
Aug 29, 2008, 10:25:36 PM8/29/08
to ack-...@googlegroups.com
weird stupidity on my part with respect to messing up my reply with a
part of your post. Apologies.

Ignore the bit that says "> mail server, which has an Athlon X2, FC9,
x86_64, perl 5.10.0,". That sentence should read "...420 MB), ack
still takes..."

Reply all
Reply to author
Forward
0 new messages