Ihor Radchenko writes: > Christian Moe writes: > >> After upgrading to 9.7 (still on Emacs 27.1), I'm seeing very long waits >> when trying to use tag completion in large files, whether with C-c C-q, >> %^g in capture templates or running (org-get-buffer-tags) directly. This >> applies both to 9.7.1 and 9.7.2 (on two different machines with similar >> environments, both older hardware). On repeated tries I have also had >> several freezes. > > May you please record the CPU profile? > You can do > 1. M-x profiler-stop > 2. M-x profiler-start RET cpu RET > 3. Query tags > 4. M-x profiler-report > 5. M-x profiler-report-write-profile > 6. Share the saved file Thanks! I attach a profile report (for a largeish file with 67 tags across 1515 headings, 17K+ lines, 18–36 seconds wait to get tags). I thought for a while that maybe advice from vertico-mode was the problem, but eliminating vertico-mode from the config didn't help; still, I also attach a profile report from a run without vertico-mode. I tried starting emacs with an empty .emacs file; it didn't solve the problem, so I haven't located any problem in my config. (Starting emacs with 'emacs -Q' did help - but only because it threw me back to built-in org 9.3.) I experimented with generating simulated Org documents with varying numbers of tagged headings (n=500, 1000, ... 5000) and doing (benchmark-run (org-get-buffer-tags)) in them. The time needed to get the tags seems to grow polynomially with n^2. Yours, Christian