-
Notifications
You must be signed in to change notification settings - Fork 375
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
Any way to speed up loading large files/files with long lines? #2500
Comments
Try disabling highlighting? |
Already disabled. |
Then nothing should help out of the box in current state. |
I don't know. I have a feeling the slowdown happens at load/parse time, before the content hits any Android components. Notice that once the file finally loads and shows up, switching back and forth between VIEW and EDIT is actually seamless, even with edits and changes to the file. Sadly I am currently not in a position to try and tackle this myself, or else I'd probably give it a shot. |
EditText.setText() and reading/concatting string sure are taking time |
Hmm, I'm guessing you're using the same At the same time, I have this file manager, it comes with a built-in text editor, and when I rename the same document from MD to TXT and open it with that, it loads up in a second. How come? I'm assuming it's also just using the standard Android I have all the "fancy" stuff in Markor (highlight, line numbers) turned off, so I would think it should be about the same workload... |
Can you post a sample file? |
Sure, here it is. |
99% this is EditText being slow at layout for large files. If you disable line wrapping it gets about 2x faster. |
My line wrapping is already disabled. I'd hate to see the performance if it wasn't disabled then... 🙁 Still baffled at how this other file manager does it so snappily. It even has wrapping enabled and no way to disable it (its editor is pretty simple). I was using the same file in both. |
As you speak about filemanager, is it really mainly about the EDITOR or are you speaking about some file browser file listing also? |
It's the built-in text editor that gets launched when you tap on a file in the manager. File listing works just fine in both Markor and the file manager. BTW the file manager I keep mentioning is Solid Explorer. |
I tried a couple text editors and they are all at least as slow as markor. If you can find an open source editor which is fast, I can look into what they do |
Bill Farmer's Notepad is quite fast. Just tried it with this same document. It's even capable of rendering Markdown into a local HTML file and starting a web browser to show it. |
Thanks. Lol this file is a monument https://github.com/billthefarmer/editor/blob/master/src/main/java/org/billthefarmer/editor/Editor.java |
Yep, I noticed. Basically the entire editor UI is implemented in this one class. Eventually it does just come down to Worth mentioning, it sets the |
Playing around with Bill Farmer's editor I get the same result as we do with markor. It takes a long time to lay out the file if wrapping is turned on. |
Understandable I guess, but keep in mind wrapping was always off in Markor for me, yet it still takes ages (and in fact crashes after a while most of the time). If you could get it to be faster at least with wrapping off, that would already be an improvement. To be honest, I never even tried Bill's Notepad with wrapping on, since I don't have wrapping on in Markor anyway. |
What phone do you have? |
On my device it takes ~2s for the file to load without wrapping on |
Markor. I have a pixel 7 pro. |
I may have discovered something. If I load up this large document in Markor directly in EDIT mode, it indeed loads up practically instantly. It even renders fast when I then switch to VIEW. However, I have always had "prefer view mode" option enabled. With that turned on, if I open the document straight from the file selector, then it suddenly takes ages. I bet you have your Markor set up to go into EDIT first. So how come going straight to EDIT and then VIEW works blazingly fast, yet trying to go straight to VIEW is so painstakingly slow? Hopefully there is some part of this particular chain that can be sped up. I really do prefer to mostly view my documents as a sort of reference material, editing is considerably more rare for me. |
I can reproduce this and it is strange indeed. Will investigate |
Glad you were able to reproduce. Means I'm not entirely crazy. 🙂 Not sure what I am to test though? Is there a precompiled version with this PR merged in? Unfortunately I can't compile stuff myself right now. |
https://github.com/gsantner/markor/actions/runs/12804106180/artifacts/2439195070 You'll get a zip which has an apk inside it. The apk will install as 'Marder' alongside your existing Markor |
Got I. Yeah, definitely much much faster. Loads the document in VIEW mode in a second or two, versus many minutes before. Not sure how your changes improve the performance so much (how is setting views to If you leave it this way, that's already a huge improvement, but as you indicated, it might be worth figuring out if this is really the best solution. Plus, IMO, it might be worth reworking the loader so it loads in the background while showing some spinning animation, instead of hogging the UI and making it look like it froze (if only briefly with your latest changes). But again, your call. I'm happy to just take the improvement you just made. |
Description
Information
Source
Format / File type
The text was updated successfully, but these errors were encountered: