After further off-list discussion and online debugging, we have managed to find out the culprit.
Thanks, Rudolf, for the kind assistance with debugging! The slowdown mostly came from the new version of `org-html-format-latex' that copies the parent Org buffer environment when generating LaTeX images. There were a couple of bottlenecks. In addition, we have found a critical bug caused by `buffer-file-name' being non-nil in the buffer copies during export. The bug existed forever but was previously much harder to be triggered. Now, everything should be fixed on main via https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5a167f6ef20e337c9b1063097ebe64624ad932a6 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=aa90e5b59cc0fe41072cd6f78968e0b8d5ac6939 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4cb1b8ebd006e0659a34c942ab5594f177d6bf49 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0551eba40ca1cdeac8645c8614747566025a7e94 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b45911d41e9d81bc23b93d7e75d0a7611ae18f38 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=09fd5f886a81af686ac0b69af19eb7a8d2007284 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=514e3a9cd26e150f6ee7251433e14701b62f7e98 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=dcdf98a564d17f918afbb947dfc6c96244b94abb https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0be36ac13eee17b3bf26ea55ba596bf61b71602d Export copy buffer now can never be saved to disk and will never corrupt the source Org file. Rudolf, please kindly confirm that the export performance is back to satisfactory on the latest main. -- 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>