Skip to content
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

Make Lines iterator more efficient #25

Closed
cessen opened this issue Sep 1, 2019 · 2 comments · Fixed by #70
Closed

Make Lines iterator more efficient #25

cessen opened this issue Sep 1, 2019 · 2 comments · Fixed by #70
Assignees

Comments

@cessen
Copy link
Owner

cessen commented Sep 1, 2019

Currently the Lines iterator is roughly equivalent to just calling Rope::line() repeatedly with an incrementing index. This is O(log N) for each call to Lines::next(), and also is just generally less efficient than it needs to be. This is not only sub-optimal, but also stands out compared to the other iterators which are all O(1) and very fast.

It should be possible to also make Lines O(1) and just generally more efficient.

@poliorcetics
Copy link

poliorcetics commented Oct 31, 2022

I was exploring this issue this weekend and I think I have a possible solution, I'll try to post a PR within the month :), it needs lots of polishing and perf testing (thankfully testing for correctness is just comparing to the slow version so that part is easy)

@pascalkuthe
Copy link
Collaborator

I was exploring this issue this weekend and I think I have a possible solution, I'll try to post a PR within the month :), it needs lots of polishing and perf testing (thankfully testing for correctness is just comparing to the slow version so that part is easy)

That's a bit unfortunate timing we did some duplicate work here (see my comment in helix-editor/helix#4457). Perhaphs we can combinme efforts

@cessen cessen linked a pull request Nov 9, 2022 that will close this issue
kirawi added a commit to kirawi/helix that referenced this issue Nov 28, 2022
the-mikedavis pushed a commit to helix-editor/helix that referenced this issue Nov 29, 2022
herkhinah pushed a commit to herkhinah/helix that referenced this issue Dec 11, 2022
freqmod pushed a commit to freqmod/helix that referenced this issue Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants