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

Geany really slow when opening huge text files #1969

Closed
oscardssmith opened this issue Oct 4, 2018 · 7 comments
Closed

Geany really slow when opening huge text files #1969

oscardssmith opened this issue Oct 4, 2018 · 7 comments

Comments

@oscardssmith
Copy link

I have a 400mb text file (neural network weights, it's horrible I know) and whenever I open it with geany, geany basically just freezes. How hard would it be to only load the bits neaded to fill a screen (or 100) at a time instead of the whole file (assuming that's what geany is doing).

I am on ubuntu 18.04 with geany 1.32.

@elextr
Copy link
Member

elextr commented Oct 4, 2018

Things that are done on a whole file at load time:

  1. if encoding isn't specified by the open dialog, possibly multiple passes through the file will take place to attempt to find the encoding.

  2. if the file has a filetype then the editing widget will run the lexer over the file to generate highlighting

  3. if the filetype has a symbol parser that will run on the entire file

But if the encoding is specified and "None" and the filetype is specified as "None" both in the "More Options" section of the Open dialog then those actions should not occur. Hopefully that will speed things up.

@oscardssmith
Copy link
Author

would it be possible to have highlighting and parsing turn off above a specific size? Also if figuring out the filetype will take more than 5 seconds, I feel like it might be worth prompting the user, as if they know, then they will save time.

@elextr
Copy link
Member

elextr commented Oct 4, 2018

These things have been discussed before, and the conclusion is, no, there is no reasonable definition of "big", it totally depends on your computer speed, and also on whether you actually want those things I listed above to happen. Geany is used on Raspberry Pis and workstations with high end GPUs, "big" and "fast" is not comparable between those so there is no way to decide how long something will take.

Geany is a programming IDE, it is designed to edit reasonable sized (for humans) program language files, thats its primary use-case. It is capable of editing other files (large logs are a common example) but they are not the core focus, so the defaults are set for the core use-case and options to turn off encoding and filetypes are available for other cases if those features are not required.

Having Geany try to be "smart" in the way that you suggested will only result in it being more annoying to some part of the primary use-case population, and thats a negative.

@elextr
Copy link
Member

elextr commented Oct 4, 2018

PS did turning the filetype and encoding off fix the problem?

@oscardssmith
Copy link
Author

I just switched to using less for the file. Would it be possible to have a big-file size in the various settings page? That would let it default off, but for users who want this somewhat frequently, they could set it to 1g to mean everything over 1g, turn off anything that requires storing the whole thing in memory.

@elextr
Copy link
Member

elextr commented Oct 5, 2018

We can stop multiple passes through files while they are opened to reduce loading delays.

But open files will always be loaded into memory, thats the way the editing widget Geany uses works, it is a gap buffer. And since the editing widget also allocates a style byte for each byte in the file, you actually use twice the memory, plus per line data.

@oscardssmith
Copy link
Author

ok not sure much can be done that will make this work for my use case

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

No branches or pull requests

2 participants