Skip to content
Text docs0.2

Aho-Corasick benchmarks

Latest stable Based on Text release 0.2.1

The 0.2.1 baseline records JMH throughput snapshots for large dictionaries, dense matches, no-match text, Flow collection, a naive small-dictionary comparison, and NFKC normalization. Higher ops/s is better.

ItemValue
command./gradlew :text-search:benchmark
hostApple M4 Pro, 48 GiB memory
JVMGraalVM JDK 21.0.11
modethroughput, 1 thread, 1 fork
warmup2 × 1 second
measurement5 × 1 second
BenchmarkOps/sWhat it exercises
parseTextNoMatch12,209.235,000-keyword automaton with no matches
parseTextDenseMatches3,566.90dense overlapping candidate matches
parseTextLargeDictionary3,116.995,000 keywords and 2,000 matched tokens
matchesAsFlowLargeDictionaryCollect712.62Flow collection over the large dictionary input
naiveContainsSmallDictionary248.39sequential String.contains over 1,000 keywords
parseTextNfkcNormalization3.68NFKC and case-insensitive normalization path

The NFKC result demonstrates why normalization should be an explicit requirement rather than a default applied without measurement. It is not directly comparable to the raw no-match case as an algorithm ranking because the work differs.

These values are local comparable snapshots, not production rankings. Compare a later result only when benchmark source, fixture sizes, command, JDK, hardware class, forks, warmup, measurement, and ops/s direction remain compatible.

The naive small-dictionary case is a reference workload, not proof that every application gains the same factor. Construction cost and memory are outside these throughput values; measure them separately when automatons change frequently.

Terminal window
./gradlew :text-search:benchmark

Keep the raw JSON. Report the score and error range, explain material fixture changes, and avoid merging values from different environments into one trend line.

Use regular search methods for immediate in-memory results. Use Flow for pipeline and cancellation semantics, understanding that the recorded collection path has additional overhead. Enable normalization only for a demonstrated Unicode equivalence requirement.

Continue with the Text search module, search example, and startup and memory.