Skip to content

Improve built-in search performance

Waqar Ahmed requested to merge work/faster-search into master
  • Don't use a moving range in the search loop. Its just extra work for no reason. Instead use a simple range and update moving range once we break out of the loop
  • Don't use a timer, we spend more time checking elapsed() than doing actual search. Instead use a match counter, if we hit 50K matches, break and start over. This is much faster than using the counter and since we are so fast, most searches will be over before the user can reach cancel button. For bigger files (1 million lines), this is still faster (finishes within 1 sec).

Imo, if we are fast enough we don't need this complicated start/break loop and can just do it all in one go, would be much simpler and a lot less code.

Merge request reports