Skip to main content
QUICK REVIEW

[Paper Review] The Exact String Matching Problem: a Comprehensive Experimental Evaluation

Simone Faro, Thierry Lecroq|arXiv (Cornell University)|Dec 12, 2010
Algorithms and Data CompressionComputer Science58 references32 citations
TL;DR

This paper presents a comprehensive experimental evaluation of 85 exact string matching algorithms across diverse pattern lengths and alphabet sizes. It identifies the most efficient algorithms for specific conditions, such as TVSBS for very short patterns and SSEF for very long patterns, with performance heavily dependent on pattern length and alphabet size.

ABSTRACT

This paper addresses the online exact string matching problem which consists in finding all occurrences of a given pattern p in a text t. It is an extensively studied problem in computer science, mainly due to its direct applications to such diverse areas as text, image and signal processing, speech analysis and recognition, data compression, information retrieval, computational biology and chemistry. Since 1970 more than 80 string matching algorithms have been proposed, and more than 50% of them in the last ten years. In this note we present a comprehensive list of all string matching algorithms and present experimental results in order to compare them from a practical point of view. From our experimental evaluation it turns out that the performance of the algorithms are quite different for different alphabet sizes and pattern length.

Motivation & Objective

  • To provide a complete and systematic comparison of all known exact string matching algorithms proposed between 1970 and 2010.
  • To evaluate the practical performance of comparison-based, automata-based, and bit-parallel string matching algorithms under varying conditions.
  • To identify the most efficient algorithms for different combinations of pattern length and alphabet size.
  • To offer practical guidance for selecting optimal string matching algorithms in real-world applications.
  • To analyze the impact of pattern length and alphabet size on algorithm efficiency through extensive experimentation.

Proposed method

  • The authors implemented and evaluated 85 exact string matching algorithms, including comparison-based (e.g., KMP, Boyer-Moore), automata-based (e.g., BOM, EBOM), and bit-parallel (e.g., BNDM, SBNDM) variants.
  • Experiments were conducted on 12 diverse text types to assess performance across different data characteristics.
  • Algorithms were evaluated across four pattern length classes: very short (m ≤ 4), short (4 < m ≤ 32), long (32 < m ≤ 256), and very long (m > 256).
  • Alphabet sizes were categorized into four groups: very small (σ < 4), small (4 ≤ σ < 32), large (32 ≤ σ < 128), and very large (σ > 128).
  • Performance was measured using average number of character comparisons per text character, normalized across all test cases.
  • The evaluation used a standardized experimental framework to ensure fair and reproducible comparisons across all algorithms.

Experimental results

Research questions

  • RQ1Which string matching algorithm performs best for very short patterns (m ≤ 4) across different alphabet sizes?
  • RQ2How does algorithm performance vary with increasing pattern length and alphabet size?
  • RQ3Which algorithms maintain high efficiency across all pattern length and alphabet size combinations?
  • RQ4What is the relative performance of bit-parallel, automata-based, and comparison-based algorithms under different conditions?
  • RQ5Are there specific algorithm configurations (e.g., with q-grams or loop-unrolling) that significantly improve performance for long or very long patterns?

Key findings

  • For very short patterns (m ≤ 4), the SA algorithm achieves the best performance with very small alphabets (σ < 4).
  • The TVSBS algorithm is the fastest for very short patterns when the alphabet is small, and also performs best for long patterns with large alphabets (σ ≥ 32).
  • For very short patterns and large or very large alphabets, the FJS algorithm delivers the best results.
  • For short patterns (4 < m ≤ 32), the EBOM algorithm is most efficient with large and very large alphabets, while SBNDM-BMH and BMH-SBNDM are optimal for very large alphabets.
  • For long patterns (32 < m ≤ 256), the HASH $q$ algorithm performs best with small alphabets, while FSBNDM excels with large and very large alphabets.
  • For very long patterns (m > 256), the SSEF algorithm achieves the best performance, though FSBNDM occasionally outperforms it.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.