V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
cabbala

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

  •  
  •   cabbala · Jan 8, 2013 · 4827 views
    This topic created in 4857 days ago, the information mentioned may be changed or developed.
    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.
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3190 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 00:25 · PVG 08:25 · LAX 17:25 · JFK 20:25
    ♥ Do have faith in what you're doing.