fix: stabilize editor layout sizing to prevent large-file open slowdown#2769
Conversation
Restore one-shot min-height initialization and avoid per-layout min-height churn, with guardrail comments to prevent reintroducing startup relayout regressions. This fixes a major speed regression introduced in commit 64ff85b in PR gsantner#2521 (squashed into b2f4407) that made loading of big files and opening the keyboard incredibly slow and proportional to the file size. Signed-off-by: Stephen L. <LRQ3000@gmail.com> Using OpenCode with ChatGPT Codex-5.3 + git-bisect
Signed-off-by: Stephen L. <LRQ3000@gmail.com>
…ditorMinHeightOnce() to do one-shot editor min-height sync to prevent large-file open slowdown + cover more cases as originally intended in 64ff85b Signed-off-by: Stephen L. <LRQ3000@gmail.com>
|
I pushed a small update to get even closer to feature parity with the original intent in the 64ff85b commit that introduced the speed regression. Unfortunately, this commit's description is quite indescript ("Better layout"), so I used AI to try to infer the original intents and what features may be lost with the speed regression fix, here is the chatlog: I tested several of those edge cases, especially rotation after a large note is already opened in the editor, and I saw no noticeably slowdown compared to v2.14.1 nor UI discrepancies compared to v2.16.0, so in practice the "main edge case" is handled in my field tests. |
…wn (PR #2769, closes #2739 #2652 #2716) * fix: stabilize editor layout sizing to prevent large-file open slowdown Restore one-shot min-height initialization and avoid per-layout min-height churn, with guardrail comments to prevent reintroducing startup relayout regressions. This fixes a major speed regression introduced in commit 64ff85b in PR #2521 (squashed into b2f4407) that made loading of big files and opening the keyboard incredibly slow and proportional to the file size. * docs: add lrq3000 in CONTRIBUTORS.md * fix: Refactor speed regression fix duplications into a function syncEditorMinHeightOnce() to do one-shot editor min-height sync to prevent large-file open slowdown + cover more cases as originally intended in 64ff85b Signed-off-by: Stephen L. <LRQ3000@gmail.com>
…wn (PR #2769, closes #2739 #2652 #2716) * fix: stabilize editor layout sizing to prevent large-file open slowdown Restore one-shot min-height initialization and avoid per-layout min-height churn, with guardrail comments to prevent reintroducing startup relayout regressions. This fixes a major speed regression introduced in commit 64ff85b in PR #2521 (squashed into b2f4407) that made loading of big files and opening the keyboard incredibly slow and proportional to the file size. * docs: add lrq3000 in CONTRIBUTORS.md * fix: Refactor speed regression fix duplications into a function syncEditorMinHeightOnce() to do one-shot editor min-height sync to prevent large-file open slowdown + cover more cases as originally intended in 64ff85b Signed-off-by: Stephen L. <LRQ3000@gmail.com>
|
@gsantner Awesome, thank you so much for fast-tracking the merge of this PR! Yes #2770 is riskier so I will do extensive testing myself before tagging it as ready, and even then I understand there will have to be a decision whether or not to merge it in. So far the progress is good and I think we may get a stable release with features parity for the large text editor soon-ish :-) Also if you are open to getting donations, please let me know how you would like to proceed, you can also contact me at my e-mail LRQ3000 at gmail dot com :-) (PS: don't worry, my e-mail is already displayed on every commits messages so I don't care much at this point). |
| _verticalScrollView.post(ensureMinHeight); | ||
| // Keep this as a one-shot min-height sync. Do not use a persistent layout listener here, | ||
| // otherwise large documents trigger repeated relayout work during startup. | ||
| syncEditorMinHeightOnce(_verticalScrollView); |
There was a problem hiding this comment.
what happens if the window is resized (i.e. in multi window mode)?
There was a problem hiding this comment.
I did not test but it should work just like Markor v2.14.1 and earlier so it should be fine. I will give it a try.
Summary
Details
DocumentEditAndViewFragmentnow uses one-shot min-height synchronization during startup instead of persistent per-layout updates.document__fragment__edit.xmleditor sizing was adjusted to align with the stable pre-regression layout behavior.Related issues
Fixes #2739, #2716, #2652.
Test Build
The test build (Marder) is available here: https://github.com/lrq3000/markor/actions/runs/23170909092
Authorship
This was made with an AI agentic co-development using git-bisect and OpenCode with ChatGPT Codex-5.3
Additional comments
Please let me know if the fix is alright for you guys, I don't know the downstream consequences of these changes since I don't know the codebase.
I would suggest to add an automated performance test in the ci to ensure there is no more speed regression in the future. I can try to implement one as I was the one implementing these speed regression tests in the
tqdmpython module, so I have some experience on how to do that reliably (using AST decomposition instead of a timer, because otherwise the tests will randomly fail depending on the CI cloud server usage and that's very bothersome). But I am not sure this is possible in Android, but I can try. Just let me know if you would be interested in adding this to the project if my endeavor is successful.Note that in any case, I would work on the automated performance unit test as a separate PR, because I know from experience that this is a very complex kind of unit test, very time consuming to make robustly, and so it's better in a separate PR (and I may not have the time to ever tackle it so the current fix should not depend on the performance unit test).
Todo