the_silver_searcher- 比ack还要快的搜索工具

2013-01-08 14:25:18 +08:00
 cabbala
https://github.com/ggreer/the_silver_searcher#how-is-it-so-fast

尝试了下,比ack快多了,完虐grep当然更是毫无压力。

安装后用法和ack类似,ag xxx即可

How is it so fast?
Searching for literals (no regex) uses Boyer-Moore-Horspool strstr.
Files are mmap()ed instead of read into a buffer.
If you're building with PCRE 8.21 or greater, regex searches use the JIT compiler.
Ag calls pcre_study() before executing the regex on a jillion files.
Instead of calling fnmatch() on every pattern in your ignore files, non-regex patterns are loaded into an array and binary searched.
Ag uses Pthreads to take advantage of multiple CPU cores and search files in parallel.
4021 次点击
所在节点    分享发现
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/56983

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX