我的 Emacs(Windows 10 64 位下的 GNU Emacs 25.1.1 (x86_64-w64-mingw32))变得异常缓慢且不稳定,尤其是在 Org 模式下,例如可能会暂停 2 秒以上来移动光标,并暂停 3 秒以上来刷新以显示展开的树。
根据我的 benchmark-init 报告,我通过修剪 .emacs 中的内容来减少 require 和 load 语句,将它们更改为 autoload hook 或 load after eval,从而缩小了规模。
我还完成了一些分析器报告,其中一些结果对我来说看起来很难解释(例如“line-move-visual”使用大量内存),并且我不知道下面的一些过程是由什么打包的如何调整和更改以提高性能。下面是分析器报告 (mem+cpu) 的部分扩展输出,同时处理大约 1500 行的 .org 文件,提前致谢!
(work.org at ~1500 lines)
- command-execute 259,247,035 98%
- call-interactively 259,247,035 98%
- funcall-interactively 259,142,758 98%
- previous-line 203,846,889 77%
- line-move 203,846,889 77%
- line-move-visual 92,655,384 35%
- posn-at-point 3,520 0%
file-remote-p 3,520 0%
window-inside-pixel-edges 12,844 0%
- org-cycle 46,120,698 17%
- org-cycle-internal-local 45,429,666 17%
- run-hook-with-args 45,176,010 17%
- org-optimize-window-after-visibility-change 41,890,667 15%
- org-subtree-end-visible-p 41,862,858 15%
- pos-visible-in-window-p 2,111,314 0%
- jit-lock-function 153,338 0%
- jit-lock-fontify-now 150,304 0%
- jit-lock--run-functions 135,144 0%
- run-hook-wrapped 135,144 0%
+ #<compiled 0x2c09399> 135,144 0%
#<compiled 0x2cf3709> 15,160 0%
file-remote-p 18,898 0%
+ eval 1,056 0%
org-end-of-subtree 1,056 0%
+ recenter 21,840 0%
+ org-cycle-hide-archived-subtrees 47,260 0%
org-cycle-show-empty-lines 9,232 0%
+ org-cycle-hide-drawers 2,936 0%
+ org-show-children 12,456 0%
outline-next-heading 5,120 0%
+ org-show-entry 1,776 0%
+ outline-flag-region 1,520 0%
+ org-hide-block-toggle-maybe 114,356 0%
+ run-hook-with-args-until-success 11,744 0%
+ org-cycle-item-indentation 6,198 0%
+ org-cycle-level 5,648 0%
org-at-table-p 5,312 0%
+ execute-extended-command 8,947,699 3%
+ next-line 227,472 0%
+ byte-code 104,277 0%
+ redisplay_internal (C function) 4,519,393 1%
+ elscreen-run-screen-update-hook 17,698 0%
internal-timer-start-idle 8,137 0%
+ timer-event-handler 2,000 0%
+ eldoc-schedule-timer 1,056 0%
... 0 0%