Ihor Radchenko writes: > "Christopher M. Miles" writes: > >> Here is the profiler report: >> >> CPU: >> >> #+begin_example >> 4003 66% - command-execute >> 4003 66% - call-interactively >> 3913 65% - funcall-interactively >> 3320 55% - kill-buffer >> 3318 55% - org-persist-write-all-buffer >> 3318 55% - org-persist-write-all > > Sorry for this. Should be already fixed by 5abd149cf. Are you on latest > main? > > Best, > Ihor Thanks for quick patch, I'm on the latest main. and I pulled your patch. Now it's not infinite looping, but still takes about 3.5 seconds. So I take another profiler profiling again. CPU #+begin_example 4824 88% - command-execute 4824 88% - call-interactively 4797 87% - funcall-interactively 4313 78% - kill-buffer 4310 78% - org-persist-write-all-buffer 4310 78% - org-persist-write-all 4310 78% - if 4310 78% - let 4310 78% - while 4310 78% - let 4310 78% - if 4310 78% - progn 4310 78% - org-persist-write 4310 78% - if 4310 78% - save-current-buffer 4310 78% - let 3903 71% - let 3903 71% - if 3903 71% - if 3858 70% - progn 3858 70% - let 3380 61% - unwind-protect 3380 61% - prog1 3380 61% - save-current-buffer 103 1% + write-region 390 7% + let 88 1% if 405 7% + org-persist--get-index 2 0% + setq 1 0% + auto-revert-notify-rm-watch 1 0% + valign--maybe-clean-advice 1 0% + recentf-track-closed-file 484 8% + counsel-M-x 27 0% + ivy-completing-read 642 11% - ... 642 11% Automatic GC 1 0% + global-font-lock-mode-check-buffers 1 0% + redisplay_internal (C function) #+end_example Memory: #+begin_example 4,155,608,836 99% - command-execute 4,155,608,836 99% - call-interactively 4,155,381,887 99% - funcall-interactively 4,151,008,326 99% - kill-buffer 4,151,002,497 99% - org-persist-write-all-buffer 4,151,002,497 99% - org-persist-write-all 4,151,002,497 99% - if 4,151,002,497 99% - let 4,151,002,497 99% - while 4,151,002,497 99% - let 4,151,002,497 99% - if 4,150,994,313 99% - progn 4,150,994,313 99% - org-persist-write 4,150,994,313 99% - if 4,150,994,313 99% - save-current-buffer 4,150,994,313 99% - let 4,140,546,179 99% - let 4,140,546,179 99% - if 4,140,546,179 99% - if 4,140,540,035 99% - progn 4,140,540,035 99% - let 3,879,416,903 93% - unwind-protect 3,879,416,903 93% - prog1 3,879,416,903 93% - save-current-buffer 20,391,917 0% - write-region 20,165,663 0% + select-safe-coding-system 226,254 0% + make-lock-file-name 256,994 0% + prin1 260,984,307 6% + let 122,760 0% + if 16,065 0% generate-new-buffer 7,942,223 0% + org-persist--get-index 2,505,911 0% + setq 8,184 0% + or 3,072 0% + tramp-flush-file-function 1,120 0% + preview-kill-buffer-cleanup 1,024 0% + save-place-to-alist 613 0% + replace-buffer-in-windows 4,373,561 0% + counsel-M-x 226,949 0% + ivy-completing-read 65,528 0% + ... 20,692 0% + redisplay_internal (C function) #+end_example