Improve performance of select-all-matches (#6700)
This fixes #6440. The previous approach was calling select-next-match in a loop, which leaves optimizations on the table when you already know that you want to select all of the matches. So what we did here is to optimize the code for the "give me all matches" case: 1. Find all results in the current buffer 2. Build up *all* selections 3. Sort selections & throw away overlapping ones (keep oldest) 4. Unfold if necessary 5. Render selections On my M3 Max searching for `<span` in the test file [1] from the ticket, it previously took: ~1.07s now takes: ~4ms [1]: https://github.com/standardebooks/edgar-allan-poe_poetry/blob/master/src/epub/text/poetry.xhtml  ### Release Notes: - Improved performance of select-all-matches by factor of ~250 ([#6440](https://github.com/zed-industries/zed/issues/6440)).
T
Thorsten Ball committed
50c3ad963e5bab5225d4b28d891d40b490df0c14
Committed by GitHub <noreply@github.com>
on 1/25/2024, 12:59:46 PM