Optimize the longest match search.
1.2.2