Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ag is way faster.


It seems an order of magnitude slower to me:

    $ time grep -r some_token .
    real	0m0.467s
    user	0m0.252s
    sys 	0m0.215s

    $ time ag some_token
    real	0m2.948s
    user	0m0.112s
    sys 	0m3.083s
(Both run twice to ensure the disk cache was warm).

Am I doing something wrong?


Could be to do with where you're searching. The fact that ag skips everything in your .gitignore seems to have helped when I tested. Both of these were run at the root of my projects directory...

  $ time grep -r f_admin .
  35.87s user 6.50s system 65% cpu 1:04.47 total

  $ time ag f_admin
  1.51s user 4.94s system 196% cpu 3.284 total


I'm searching mostly C code. I'm in the src directory, so there's nothing there except the source code.


What were you searching? I want to reproduce this.


It's a proprietary codebase, but it consists of around 500MB of mostly C and C++ files and their headers. There are a few other files (makefiles, a few perl/python scripts).


Is there any chance you could create a reproducible test case? I'm very curious as to what's causing the slowdown.


And it automatically ignores .git, .svn and other distractions, has plenty of handy options (`ag --nojs --noruby --perl some_text`)




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: