Hello Ihor,

This is the profiler report:

[profiler-profile "28.1" cpu #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ([nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 11 ["#<subr auto-revert-buffers>" auto-revert-buffers--buffer-list-filter apply auto-revert-buffers apply timer-event-handler nil nil nil nil nil nil nil nil nil nil] 12 ["#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_9>" apply timer-event-handler nil nil nil nil nil nil nil nil nil nil nil nil nil] 7 ["#<compiled 0x1a044bbfab7c2ab2>" execute-extended-command--shorter "#<compiled -0x20b067094a388be>" apply timer-event-handler nil nil nil nil nil nil nil nil nil nil nil] 19 ["#<compiled 0x7850c1edb66e883>" completion--some completion--nth-completion completion-try-completion execute-extended-command--shorter "#<compiled -0x20b067094a388be>" apply timer-event-handler nil nil nil nil nil nil nil nil] 20 [completion-pcm--find-all-completions completion-pcm-try-completion "#<compiled 0x7850c1f5dbee883>" completion--some completion--nth-completion completion-try-completion execute-extended-command--shorter "#<compiled -0x20b067094a388be>" apply timer-event-handler nil nil nil nil nil nil] 36 [completion-pcm--merge-try completion-pcm-try-completion "#<compiled 0x7850c1f5dbee883>" completion--some completion--nth-completion completion-try-completion execute-extended-command--shorter "#<compiled -0x20b067094a388be>" apply timer-event-handler nil nil nil nil nil nil] 4 ["#<compiled 0x11470000ec98926f>" "#<compiled -0x20b067094a388be>" apply timer-event-handler nil nil nil nil nil nil nil nil nil nil nil nil] 1 [read--expression byte-code command-execute nil nil nil nil nil nil nil nil nil nil nil nil nil] 4 [byte-code command-execute nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 39 ["#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_9>" apply timer-event-handler read--expression byte-code command-execute nil nil nil nil nil nil nil nil nil nil] 1 [auto-revert-handler auto-revert-buffer "#<subr auto-revert-buffers>" auto-revert-buffers--buffer-list-filter apply auto-revert-buffers apply timer-event-handler read--expression byte-code command-execute nil nil nil nil nil] 7 [internal-timer-start-idle read--expression byte-code command-execute nil nil nil nil nil nil nil nil nil nil nil nil] 3 [org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil nil nil nil] 55 [org-element--current-element org-element--parse-to org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil nil] 376 [org-element--parse-to org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil nil nil] 196 [org-parse-time-string org-element-timestamp-parser org-element-clock-parser org-element--current-element org-element--parse-to org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil] 92 [org-element-clock-parser org-element--current-element org-element--parse-to org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil] 246 [org-element-timestamp-parser org-element-clock-parser org-element--current-element org-element--parse-to org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil] 108 [org-get-limited-outline-regexp org-element--current-element org-element--parse-to org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil] 4 [org-element-section-parser org-element--current-element org-element--parse-to org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil] 32 [org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil nil nil nil nil nil] 4 [derived-mode-p org-get-limited-outline-regexp org-element--current-element org-element--parse-to org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil] 4 [org-element--cache-put org-element--parse-to org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil nil] 7 [org-time-string-to-seconds org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil nil nil nil] 8 [org-time-string-to-time org-time-string-to-seconds org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil nil nil] 4 [org-element-headline-parser org-element--parse-to org-element-at-point org-clock-sum org-clock-sum-today eval-expression funcall-interactively command-execute nil nil nil nil nil nil nil nil] 4 ["#<compiled -0xf5c4e2a00a29a80>" "#<compiled 0x4c7cc2751b00e55>" all-completions complete-with-action "#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_54>" all-completions ivy--reset-state ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil] 10 [complete-with-action "#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_54>" all-completions ivy--reset-state ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil nil nil] 20 [all-completions complete-with-action "#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_54>" all-completions ivy--reset-state ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil nil] 8 ["#<compiled 0x4c7cc2751b00e55>" all-completions complete-with-action "#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_54>" all-completions ivy--reset-state ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil] 4 [read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil nil nil nil nil nil] 58 [ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil nil nil nil nil nil nil] 14 ["#<compiled 0x1eb9ec24af2045a5>" cl-delete cl-remove ivy--re-filter ivy--filter ivy--update-minibuffer ivy--exhibit ivy--queue-exhibit read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil] 21 [cl--position cl-position ivy--recompute-index ivy--filter ivy--update-minibuffer ivy--exhibit ivy--queue-exhibit read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil] 4 [ivy--insert-minibuffer ivy--exhibit ivy--queue-exhibit read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil nil nil] 8 ["#<compiled -0xabf49e5c423277c>" cl-remove ivy--re-filter ivy--filter ivy--update-minibuffer ivy--exhibit ivy--queue-exhibit read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil] 43 [ivy--re-filter ivy--filter ivy--update-minibuffer ivy--exhibit ivy--queue-exhibit read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil] 17 [cl-remove ivy--re-filter ivy--filter ivy--update-minibuffer ivy--exhibit ivy--queue-exhibit read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil] 22 ["#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_9>" apply timer-event-handler read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil nil nil] 12 ["#<subr auto-revert-buffers>" auto-revert-buffers--buffer-list-filter apply auto-revert-buffers apply timer-event-handler read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil] 3 [ad-Advice-delete-backward-char apply delete-backward-char funcall-interactively call-interactively ivy-backward-delete-char funcall-interactively command-execute read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil] 4 [delete-selection-pre-hook read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil nil nil nil nil] 2 [undo-auto--ensure-boundary undo-auto--boundaries undo-auto--add-boundary read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil nil nil] 2 [ivy--insert-prompt ivy--insert-minibuffer ivy--exhibit ivy--queue-exhibit read-from-minibuffer ivy-read ivy-completing-read read-extended-command-1 read-extended-command byte-code command-execute nil nil nil nil nil] 3 [funcall-interactively command-execute nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 3 [funcall-interactively command-execute execute-extended-command funcall-interactively command-execute nil nil nil nil nil nil nil nil nil nil nil] 4 [Automatic\ GC] 440)) (25563 56485 293720 164000) nil]

Thanks!
Tijs

Op wo 1 feb. 2023 om 15:59 schreef Ihor Radchenko <yantar92@posteo.net>:
Tijs Mallaerts <tijs.mallaerts@gmail.com> writes:

> After building emacs from the master branch (with Org mode version 9.6
> release_9.6-81-g563a43) I noticed the org-clock-sum-today function takes
> much more time compared to my previous emacs build (with Org mode version
> 9.5.4 release_9.5.4-19-g4dff42) in a large org buffer.
>
> Are there any settings that could speed up the calculation?

May you please
1. run M-x profiler-start <RET> cpu <RET>
2. Run org-clock-sum-today
3. M-x profiler-report
4. M-x profiler-report-write-profile
5. Share the saved profile

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>