V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
cabbala
V2EX  ›  分享发现

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

  •  
  •   cabbala · 2013-01-08 14:25:18 +08:00 · 4169 次点击
    这是一个创建于 4329 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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.
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5490 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 08:44 · PVG 16:44 · LAX 00:44 · JFK 03:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.