Closed
Description
Is your feature request related to a problem? Please describe.
According to discussions in #2565, the current implementation doesn't have an optimal complexity. It is O(n) now, but could be done in O(log(n)). We may add a benchmark to check what will happen when requesting selection ranges in a very large file.
Describe the solution you'd like
- Add a benchmark (currently there is no benchmark for plugins, so this might become the first one).
- Implement a better algorithm (see comments in
findSelectionRangesByPositions
)
Describe alternatives you've considered
Maybe we don't need to optimize, as it works very fast for files with 1000 lines, and large files are rare in practice (why not split them into smaller modules?).
Additional context
The orignal feature request is #212