Supports the opening of large files
evalcoding opened this issue · comments
Supports the opening of large files. Currently, opening large files will become particularly laggy. It is inevitable that you will encounter the problem of opening large files during use. thank you for your excellent work.
How large are you opening the files? It's better provide some examples for troubleshooting.
Of course, you can try this snippet to check if it works.
(add-hook 'find-file-hook
(lambda ()
(when (too-long-file-p)
;; or (font-lock-mode -1)
(fundamental-mode 1)
)))
Meet the most at around 30M, occasionally at around 100M, and also at 1G or above
Did you try the snippet above?
Thank you , plus the above configuration to open a normal txt file, the speed has some changes, but if there is a 5000 lines or more python file, open the search operation still need to load a long time. For example, if you open a py file for the first time, and it contains a python dict formatted with 5000 lines, it will take a long time to load when searching.
Since I don't have the examples for troubleshooting, I am wondering what about with emacs -Q
. And it's better get profiling report to move forward. See profiling
search:
176,526,018 68% + command-execute
70,353,849 27% + timer-event-handler
10,633,431 4% + redisplay_internal (C function)
211,344 0% winner-save-old-configurations
198,762 0% + substitute-command-keys
32,040 0% + sideline--post-command
17,840 0% + gcmh-register-idle-gc
16,830 0% + help-command-error-confusable-suggestions
12,328 0% + lsp-ui-sideline
12,160 0% + tooltip-show-help
10,258 0% + #<compiled -0x190659bcf02f3ea0>
8,288 0% + lsp--post-command
4,352 0% + corfu--auto-post-command
1,632 0% + #<compiled 0x181154b46c2ea924>
192 0% mouse--click-1-maybe-follows-link
184 0% global-hl-line-highlight
0 0% ...
openfile:
56,517,802 50% + timer-event-handler
35,776,794 31% + redisplay_internal (C function)
14,742,696 13% + command-execute
5,326,711 4% + #<compiled 0x1da2b4d9e51249be>
190,784 0% + winner-save-old-configurations
151,666 0% + substitute-command-keys
45,213 0% + #<compiled -0x190659bcf02f3ea0>
37,788 0% + symbol-overlay-post-command
35,268 0% + sideline--post-command
32,406 0% xselect-convert-to-string
26,224 0% + gcmh-register-idle-gc
9,424 0% + lsp--post-command
8,368 0% + lsp-ui-sideline
8,184 0% + #<compiled 0x17d1feaf6e00be7d>
6,256 0% + jit-lock--antiblink-post-command
6,144 0% + corfu--auto-post-command
5,200 0% + eldoc-schedule-timer
5,181 0% + #<compiled 0x187939225f7e66fb>
4,144 0% + clear-transient-map
3,280 0% + tooltip-show-help
1,584 0% global-hl-line-highlight
1,056 0% + clear-transient-map
816 0% + gui-set-selection
320 0% mouse--click-1-maybe-follows-link
48 0% + deactivate-mark
0 0% ...
Expand timer-event-handler
and check the CPU percentages., please.
search.zip
openfile.zip
I have exported the report for searching and exporting files to the attachment above. Thank you !
`
data = {}
for i in range(6000):
key = f'key_{i}'
value = f'value_{i}'
data[key] = value
with open('large_dict_file.py', 'w') as file:
file.write('large_dict = ')
file.write(repr(data))
file.write('\n')
`
Alternatively, you can use the above code to generate a similar file and open it in python major mode, which may cause stuttering when opening and searching. Thank you !
Thanks for the information! According to the reports, the bottleneck is highlight-indent-guides
.
Please
- Update to the latest version.
- Try to disable highlight-indent-guides-mode`.
- Evaluate
(too-long-file-p)
. - Check the value of
prog-mode-hook
.
The latest version has some effects. Thank you !