The previous conversion of describe_vector from C to Lisp for the
keymap and char table case lead to an unacceptable performance hit.
Moving back to the C version, as we do here, makes this function
around 50 times faster.
The Lisp version of `substitute-command-keys' was benchmarked using
the form `(documentation 'dired-mode)', which now takes less than 8 ms
on my machine. This is around 16 times slower than the previous C
version.
Thanks to Stefan Monnier for helpful pointers on benchmarking.
* src/keymap.c (Fhelp__describe_vector): New defun to expose
describe_vector to Lisp for keymaps and char tables.
(syms_of_keymap): New defsubr for Fhelp__describe_vector.
* lisp/help.el (describe-map): Use above defun instead of Lisp
version.
(help--describe-vector): Remove defun; keep it commented out for now.