TIL about #Emacs
If Emacs is slow to respond, you can analyse runtime behaviour with the built-in profiler.
1. Start the profiler (`M-x profiler-start`) for CPU usage.
2. Do a bit of representative work for a short while.
3. Stop the profiler (`M-x profiler-report`).
4. Check the report buffer for function calls that are high in relative CPU time.
Documentation:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Profiling.html
Apart from that, here we go again: Emacs, camouflaged as text editor, ships a profiler by default. Of course it would.