-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Desktop: Switching a note using Sidebar is slow and grayed out for a moment #6416
Comments
AnalysisTo analyze the above observations, I used Performance Analyzer in Electron's DevTool. The following image is the difference of Performance Analyzer views of note switching (A) using NoteList and (B) using SideBar. Each view are measured without plugins. The findings are:
To assess the last item deeper, another analysis was performed. The next image (C) is a view with the same condition with (B) except RichMarkdown and Math Mode plugins are added. Both plugins have large scripts and are loaded at the start of Joplin. It shows that both RichMarkdown and Math Mode plugins are also reloaded like mermaid. In conclusion, it is found that for each additional plugin that has a script for Editor/Viewer, it takes more time to switch notes using SideBar. This behavior is not desirable and would be not intended. |
CauseThe cause of the symptoms is that no note is selected for a moment after a notebook in SideBar is clicked, even if a non-empty notebook is selected. Sequence in detail:
Why "no note is selected" happens? The reason is clicking Sidebar uses
There is some time gap between the step 1 and 2, and some re-renderings are performed in the gap. This transient state of no note causes various side effects, which are sound in logic but redundant and result in the symptoms. Other triggers such as NoteList use |
To Solve the IssueTo solve the issue, several approaches are possible:
About (A), the impact of a modification will be large and prevail to multiple applications. It is not recommended. About (B), it is difficult to be implemented, because there is no available information of a target note when a notebook in SideBar is clicked. About (C), a modification will be small, and its impact will be small and closed only in the desktop app. It seems to be appropriate. According approach (C), I made PR #6430. In the above performance analysis, it seems that there are large overheads in re-rendering of SideBar and NoteList. However, even if there are many rooms for improvement, SideBar and NoteList are currently scheduled to be fundamentally refactored. So, I'll hold off on improving them for the time being. |
Performance improvement after fixed
It shows:
Besides, after PR#6430 is applied, gray-out does not happen in any case. As mentioned in the previous post, I'm not planning to improve the overheads in re-rendering of SideBar and NoteList now. So, I'll give up that switching using SideBar is as fast as one using NoteList in this issue. |
As reported in the topic of discourse, the following symptoms are observed:
The next table is an example of the above symptoms when a note swiched. The measurement conditions are: target note: "1. Welcome to Joplin!", Joplin ver: 2.7.15, CPU: Core i5-4670, and OS: Win10. To use NoteList for a trigger, select "All notes" in SideBar
The example shows interesting observations:
What is expected
Environment
The text was updated successfully, but these errors were encountered: