I’ve just uploaded a new version of ack, version 2.24, to the CPAN and posted it to beyondgrep.com.

This version of ack introduces an optimization to not search most files line-by-line until after ack has read the whole file and determined that the pattern matches in the file at all. This speeds things up quite a bit. Here are some timings in seconds for acking against the Drupal codebase. It compares ack 2.22, the just-released 2.24 and the latest beta of ack version 3:

                                    |   2.22 |   2.24 | 3 beta
--------------------------------------------------------------
          ack zqj /home/andy/drupal |   1.93 |   1.53 |   1.46
ack zqj-not-there /home/andy/drupal |   1.85 |   1.50 |   1.45
          ack foo /home/andy/drupal |   1.99 |   1.66 |   1.62
       ack foo -w /home/andy/drupal |   1.94 |   1.63 |   1.57
  ack foo\w+ -C10 /home/andy/drupal |   4.54 |   2.13 |   1.97
ack (set|get)_\w+ /home/andy/drupal |   2.01 |   1.79 |   1.79

Of course ack doesn’t have the raw speed of a tool like ripgrep, but it’s got a different feature set. See this feature comparison chart of greplike tools for details.