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

Hangs when select and edit in a 15MB file. #7396

Closed
grv07 opened this issue Jun 20, 2023 · 6 comments
Closed

Hangs when select and edit in a 15MB file. #7396

grv07 opened this issue Jun 20, 2023 · 6 comments
Labels

Comments

@grv07
Copy link
Contributor

grv07 commented Jun 20, 2023

Summary

The file is 14.9 MB in size sample data

Ok("any-string")
Ok("any-string")
Ok("any-string")
... 388892 lines like that

I try "% + s + Ok(" and it hangs

Reproduction Steps

I tried this:

  1. hx 15mb_file_name
  2. % + s + Ok( + enter

I expected this to happen:
I should be able to edit the text.

Instead, this happened:
It hangs and does not respond.

Helix log

Unable to get logs since it is not responding at all.

Platform

Linux (Ubuntu 23.04)

Terminal Emulator

alacrity + zellij

Helix Version

master

image

@grv07 grv07 added the C-bug Category: This is a bug label Jun 20, 2023
@grv07
Copy link
Contributor Author

grv07 commented Jun 20, 2023

I try this by selecting only 100 lines and it works fine but still face the same issue if select the whole file even without Zellij on Alacrity and on the Ubuntu terminal too.

@kirawi
Copy link
Member

kirawi commented Jun 20, 2023

I'm very certain there's already an issue for this, but I can't seem to find it through a quick search. Regardless, this is just a limitation of having a lot of active selections at once.

@CptPotato
Copy link
Contributor

CptPotato commented Jun 20, 2023

I've worked with very large files (hundreds of Mb) and even if helix gets slow it does respond after a little while.
Have you tried escaping the parenthesis Ok\(? If I remember correctly more complex expressions get very slow very quickly and tend to run out of memory on such large files. I'm having no issues with 1000000 lines of Ok(hi) (splitting selections takes around 1-2s maybe, editing those selection is a different story though 🙃).

Also, one way to speed this up is to yank the search text first: "/y
Then helix has to match the regex just once, and not go over the whole file for every keystroke.

@grv07
Copy link
Contributor Author

grv07 commented Jun 20, 2023

@CptPotato I have tried your first suggestion to escape the parenthesis, It still hangs for me when try to edit.

@pascalkuthe
Copy link
Member

Poeple seem to have missread the issue description: The problem is not the regex selection that is pretty fast but actually editing once there is a selection is insanely slow. I whipped up a quick flamegraph and now know why: Almost all time is spend updating the selection (ropey is so fast it doesn't even show up). The reason is simple: muiticursos edits currently have a time complexity O(N^2) for the number of cursors. Fixing that will be a bit involved but should be possible

@grv07 grv07 changed the title Hangs when try to select in a 15MB file. Hangs when try to select and edit in a 15MB file. Jun 20, 2023
@grv07 grv07 changed the title Hangs when try to select and edit in a 15MB file. Hangs when select and edit in a 15MB file. Jun 20, 2023
@pascalkuthe pascalkuthe added C-perf and removed C-bug Category: This is a bug labels Jun 20, 2023
@the-mikedavis
Copy link
Member

Fixed in #7408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants