color-identifiers-mode is very slow when hideshowvis is enabled
I can't tell which one is the issue here.
When both hideshowvis and color-identifiers-mode are in use, color-identifiers:refresh becomes very slow on large files. When hideshowvis is not loaded, color-identifiers:refresh is much faster (like .5 seconds versus 15 seconds).
To reproduce this, first get hideshowvis installed. Save this file into ~/emacs.d/lisp.
In init.el add
(use-package hideshowvis
:diminish
:load-path "~/.emacs.d/lisp"
:bind ("M-[" . hs-toggle-hiding)
:init (progn
(add-hook #'prog-mode-hook (lambda () (hideshowvis-enable) (hideshowvis-symbols)))))
That will cause hideshowvis to open when a programming file is opened, like c++.
Now we need to open a large c++ file. Download this file to ~/Downloads/inference_context.cc.
Now open that file in emacs. Confirm that there are little minus signs in the fringe which can be clicked to shrink and expand code.
Now type M-x color-identifiers:refresh. It should return in under 0.5 seconds.
Now hold page down on the keyboard until you reach the end of the file. Once again, type M-x color-identifiers:refresh. It will take noticeably longer, like 4 seconds or so. This will be the case from now on. Now page up all the way to the top and try again. Now it might be even longer, like 12 seconds.
M-x profiler-start before the slowness and then M-x profiler-report after the slowness shows 99% of the cpu time in thing-at-point, called by symbol-at-point in color-identifiers. It's not clear if that is many more calls to thing-at-point or just more time spent inside the function. I don't know a method to count calls in elisp.