jmfn / node-aho-corasick-benchmarks

Benchmark various aho-carosick node libraries against large corpus text and pattern lengths

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Benchmark various aho-corasick node libraries.

Run benchmarks for 10,000 keywords

hyperfine --export-markdown BENCHMARKS-10k.md \
  --parameter-list lib aho-corasick-node,node-aho-corasick,aho-corasick,lazy-aho-corasick,@tanishiking/aho-corasick,ahocorasick,string-dsa,aho-corasick2,@drorgl/aho-corasick2,aho-corasick-search,fastscan \
  'node index.js {lib} 10000'

Run benchmarks for 100,000 keywords

hyperfine --export-markdown BENCHMARKS-100k.md \
  --parameter-list lib aho-corasick-node,node-aho-corasick,aho-corasick,lazy-aho-corasick,@tanishiking/aho-corasick,ahocorasick,string-dsa,aho-corasick2,@drorgl/aho-corasick2,aho-corasick-search,fastscan \
  'node index.js {lib} 100000'

Summary
  'node index.js string-dsa 100000' ran
    7.88 ± 1.16 times faster than 'node index.js fastscan 100000'
   10.05 ± 2.24 times faster than 'node index.js node-aho-corasick 100000'
   14.78 ± 2.32 times faster than 'node index.js @drorgl/aho-corasick2 100000'
   15.62 ± 2.56 times faster than 'node index.js aho-corasick2 100000'
   28.13 ± 5.84 times faster than 'node index.js aho-corasick 100000'
   29.61 ± 4.39 times faster than 'node index.js aho-corasick-node 100000'
   74.87 ± 13.40 times faster than 'node index.js ahocorasick 100000'
  165.73 ± 27.94 times faster than 'node index.js lazy-aho-corasick 100000'
  257.16 ± 50.09 times faster than 'node index.js @tanishiking/aho-corasick 100000'
  346.61 ± 53.28 times faster than 'node index.js aho-corasick-search 100000'

Run benchmarks for 500,000 keywords

hyperfine --export-markdown BENCHMARKS-500k.md \
  --parameter-list lib fastscan,node-aho-corasick,@drorgl/aho-corasick2 \
  'node index.js {lib} 500000'

string-dsa threw out of memory error.

Summary
  'node index.js fastscan 500000' ran
    1.08 ± 0.04 times faster than 'node index.js node-aho-corasick 500000'
    2.02 ± 0.26 times faster than 'node index.js @drorgl/aho-corasick2 500000'

About

Benchmark various aho-carosick node libraries against large corpus text and pattern lengths


Languages

Language:JavaScript 100.0%