Thanks. It definitely helps, but it's still quite slow. What's made the biggest difference is is advising the relevant functions to turn flyspell off beforehand and then turn it back on.

```
(defun azr/org-footnote-disable-flyspell (orig-fun &rest args)
  (flyspell-mode -1)
  (apply orig-fun args)
  (flyspell-mode))

(advice-add 'org-footnote-new :around #'azr/org-footnote-disable-flyspell)
(advice-add 'org-footnote-delete :around #'azr/org-footnote-disable-flyspell)
```

Best,
Alan

On Sat, Dec 10, 2022 at 4:24 AM Ihor Radchenko <yantar92@posteo.net> wrote:
arozbiz@gmail.com writes:

> Thanks Ihor for the response. Unfortunately, setting
> org-element--cache-self-verify to nil didn't work. Profile report attached.

Thanks!
I just pushed a slight optimization to the footnote sorting code.
Can you try again using the latest main?

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=169333e1c

--
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>