Skip to content

benchmark and performance optimization for selection range #2632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kokobd opened this issue Jan 24, 2022 · 1 comment
Closed

benchmark and performance optimization for selection range #2632

kokobd opened this issue Jan 24, 2022 · 1 comment
Assignees
Labels
component: hls-code-range-plugin for code range related functionalities, such as selection range and folding range performance Issues about memory consumption, responsiveness, etc. type: enhancement New feature or request

Comments

@kokobd
Copy link
Collaborator

kokobd commented Jan 24, 2022

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

@jneira jneira added performance Issues about memory consumption, responsiveness, etc. component: hls-code-range-plugin for code range related functionalities, such as selection range and folding range and removed status: needs triage labels Jan 24, 2022
@kokobd kokobd self-assigned this Jan 26, 2022
@kokobd
Copy link
Collaborator Author

kokobd commented Jul 13, 2022

This is partially solved by #3003, where I applied binary search on each level, and tree search on the whole AST (instead of the previous naive linear search). Theoretically, the performance should improve for large files.

I think it's ok to close this issue and open another one to add benchmarks if I have the energy to do that.

@kokobd kokobd closed this as completed Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-code-range-plugin for code range related functionalities, such as selection range and folding range performance Issues about memory consumption, responsiveness, etc. type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants