项目作者: morenice

项目描述 :
C implementation Aho-Corasick string matching
高级语言: C
项目地址: git://github.com/morenice/ahocorasick.git
创建时间: 2017-04-11T14:54:33Z
项目社区:https://github.com/morenice/ahocorasick

开源协议:MIT License

下载


Build Status

C implementation Aho-Corasick string match.

  • Support multi-thread
  • Support callback match API
  • Support multiple languages(english, korean, …)
  • example: See src/main.c

Build

  1. $ mkdir build; cd build
  2. $ cmake ..
  3. $ make

Performance

Prepare

Get sample data and Build source

  1. wget http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-0.gz
  2. gzip -d googlebooks-eng-all-1gram-20120701-0.gz

Testing (file: 184MB)

ahocorasick : pattern 1984, 1985

  1. time ./ahocorasick
  2. real 0m2.253s
  3. user 0m2.180s
  4. sys 0m0.067s

fgrep : pattern 1984, 1985

  1. time fgrep -c -e 1984 -e 1985 googlebooks-eng-all-1gram-20120701-0
  2. real 0m12.269s
  3. user 0m11.389s
  4. sys 0m0.081s

See also

reference