• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..13-Dec-2021-

LICENSEH A D13-Dec-20217.5 KiB166128

README.mdH A D13-Dec-20212.4 KiB6846

_acism.hH A D13-Dec-20213.5 KiB11472

acism.cH A D13-Dec-20213.8 KiB12573

acism.hH A D13-Dec-20212.1 KiB5413

acism_create.cH A D13-Dec-202111.8 KiB382264

README.md

1aho-corasick
2==
3
4Aho-Corasick parallel string search, using interleaved arrays.
5
6Mischa Sandberg mischasan@gmail.com
7
8ACISM is an implementation of Aho-Corasick parallel string search,
9using an Interleaved State-transition Matrix.
10It combines the fastest possible Aho-Corasick implementation,
11with the smallest possible data structure (!).
12
13FEATURES
14--------
15
16* Fast. No hashing, no tree traversal; just a straight look-up equivalent to
17    matrix[state, input-byte] per input character.
18
19* Tiny. On average, the whole data structure (mostly the array) takes about 2-3 bytes per
20    input pattern byte. The original set of pattern strings can be reverse-generated from the machine.
21
22* Shareable. The state machine contains no pointers, so it can be compiled once,
23    then memory-mapped by many processes.
24
25* Searches byte vectors, not null-terminated strings.
26    Suitable for searching machine code as much as searching text.
27
28* DOS-proof. Well, that's an attribute of Aho-Corasick,
29    so no real points for that.
30
31* Stream-ready. The state can be saved between calls to search data.
32
33DOCUMENTATION
34-------------
35
36The GoogleDocs description is at http://goo.gl/lE6zG
37I originally called it "psearch", but found that name was overused by other authors.
38
39LICENSE
40-------
41
42Though I've had strong suggestions to go with BSD license, I'm going with GPL2 until I figure out
43how to keep in touch with people who download and use the code. Hence the "CONTACT ME IF..." line in the license.
44
45GETTING STARTED
46---------------
47
48Download the source, type "gmake".
49"gmake install" exports lib/libacism.a, include/acism.h and bin/acism_x.
50"acism_x.c" is a good example of calling acism_create and acism_scan/acism_more.
51
52(If you're interested in the GNUmakefile and rules.mk,
53 check my blog posts on non-recursive make, at mischasan.wordpress.com.)
54
55HISTORY
56-------
57
58The interleaved-array approach was tried and discarded in the late 70's, because the compile time was O(n^2).
59acism_create beats the problem with a "hint" array that tracks the restart points for searches.
60That, plus discarding the original idea of how to get maximal density, resulted in the tiny-fast win-win.
61
62ACKNOWLEDGEMENTS
63----------------
64
65I'd like to thank Mike Shannon, who wanted to see a machine built to make best use of L1/L2 cache.
66The change to do that doubled performance on hardware with a much larger cache than the matrix.
67Go figure.
68