Enhance large files with syntax highlighting performance#15926
Enhance large files with syntax highlighting performance#15926donho wants to merge 1 commit intonotepad-plus-plus:masterfrom
Conversation
|
@softmgr I tested with 400 MB large XML file, put the position in the middle, then quit Notepad++ and relaunch it. If I switch off this large file, by keeping its position, for switching in to a small file, close Notepad++, and relaunch it, the small file is displayed as expected. Now I switch back to this large XML file, same thing happens as described above (the content is loaded immediately and the right position scrolled, the styling comes after) - so far so good. However, without quitting this Notepad++ instance, when the large XML file is switched off then switched back, it's frozen few seconds then the styled content is shown. I didn't find what I've done wrong, so you might have the idea about it. Note that the PR in its first stage, It could be modified during the code review. |
I have a more perfect method. I’ll organize it and send it to you later. |
|
According to my personal analysis, the factors affecting the performance of large files are mainly the following three:
Additionally, I suggest removing the The following code is based on the
// ScintillaEditView.h // ScintillaEditView.cpp // Parameters.h // Parameters.cpp // Buffer.h // GoToLineDlg.cpp // NppIO.cpp // NppCommands.cpp // NppNotification.cpp // Notepad_plus.cpp // scintilla\src\Document.cxx Finally, we need to modify all calls related to
// ScintillaEditView.cpp
// AutoCompletion.h // AutoCompletion.cpp @donho |
|
@softmgr |
Based on master. |
So this PR is not re-usable? |
As of now, the above code can be used both in the master branch and in pull requests. Simply copy and paste it into the corresponding function. Based on my personal testing, the performance for handling large files is already excellent. Whether it’s opening files, jumping to specific positions, switching tabs, moving the cursor, or typing characters, everything runs very smoothly and quickly. |
|
@softmgr
Let's do it one by one - firstly Syntax highlighting. Please open an issue with your code for improving Syntax highlighting performance. I will create PR so you can review it. Once it's merged, then we move on Excessive number of folded lines then Auto-completion, with the same process. Is it doable for you? |
Sure, can you tell me how to do it? |
Please open an issue with your modified code for improving Syntax highlighting performance. Only for improving Syntax highlighting performance, and nothing more. And provide the scenario to reproduce the bad performance, so we can compare with the PR. |
Here is the re-written feature request, with the complete solution provided in the attachments: |
I do believe #15952 is completely done (latest improvement: #16021). |
I tested the latest master branch with a 200MB HTML file as a benchmark. After completely removing the clickable link feature, the loading time difference compared to disabling the setting in preferences is around 0.1-0.2 seconds. The impact is relatively small. However, personally, I still prefer to remove this feature since the context menu already provides the option to open links. However, personally, I still prefer to remove this feature since I have already added the "Open File" option in the context menu to handle link opening functionality. Additionally, it seems a new bug has appeared in the latest development version: even after disabling the "Clickable Link Settings" option in preferences, links in the document remain clickable (the underline for link text does not disappear). |
The regression was introduced by commit 71be434 Ref: notepad-plus-plus#15926 (comment)
The regression has been fixed by PR #16025
Removing completely clickable link feature should get the exactly the same performance. OTOH, a lot of people use such feature. I see no advantage to remove this feature. |
The regression was introduced by commit 71be434 Ref: #15926 (comment) Close #16025
|
I believe we can now start the second and third phases of optimization, namely: |
|
@softmgr Yes, sounds good. |
Fix #15653