Filtering non-matching candidates is the biggest perf bottleneck in the algorithm to create a text fragment, especially if the user attempts to create a text fragment for a very common string on a very large page. Since the expensive code only does string comparisons, it can easily be moved to rust and run in parallel using rayon. Differential Revision: https://phabricator.services.mozilla.com/D235559