Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Improve speed by reduce stat syscall #149

kcwu opened this Issue Nov 27, 2010 · 3 comments


None yet
3 participants

kcwu commented Nov 27, 2010

This is idea to improve file search speed.

Currently, ack use File::Next to search files.
It will stat each entry inside directory, to determine it is file or directory.
After File::Next know the entry is normal file (via -f), it will callback to ack's file_filter.

If we assume directory name won't look like file, it is possible to speed up:

  1. Check entry name first. If the name is recognized by ack, but isn't interested by this search, we can just ignore such entry.
  2. Only test it's file/dir/link if the name is not recognized by ack.

However, it may accident ignore directories with name recognized by ack. So this feature may need a option to let user turn on/off.

kcwu commented Mar 3, 2011

By the way, linux's readdir(3) return "d_type" which specify a entry is directory or not. Thus save a lot of stat(2) calls.

Linux's find(1) takes this advantage and is much faster. I don't know how to apply this trick in perl though.

@hoelzro hoelzro referenced this issue in beyondgrep/ack2 Aug 28, 2013


Improve speed by reduce stat syscall #349


hoelzro commented Aug 28, 2013

Migrated to ack2 queue.

@hoelzro hoelzro closed this Aug 28, 2013

@petdance petdance referenced this issue in beyondgrep/ack3 Mar 29, 2017


Improve speed by reduce stat syscall #44


petdance commented Mar 29, 2017

This issue was moved to petdance/ack3#44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment