arXiv · 2503.13694
Branch Prediction Analysis of Morris-Pratt and Knuth-Morris-Pratt Algorithms
Abstract
We analyze the classical Morris-Pratt and Knuth-Morris-Pratt pattern matching algorithms through the lens of computer architecture, investigating the impact of incorporating a simple branch prediction mechanism into the model of computation. Assuming a fixed pattern and a random text, we derive precise estimates of the number of mispredictions these algorithms produce using local predictors. Our approach is based on automata theory and Markov chains, providing a foundation for the theoretical analysis of other text algorithms and more advanced branch prediction strategies.
Explore related subjects
Keep this discovery
Cyril Nicaud, Carine Pivoteau, Stéphane Vialette. 2025-03-17. Branch Prediction Analysis of Morris-Pratt and Knuth-Morris-Pratt Algorithms. https://arxiv.org/abs/2503.13694
Cite the original work for its findings. Save a collection to share your selection of sources.