ema2159 / centaur-tabs

Emacs plugin aiming to become an aesthetic, modern looking tabs plugin
GNU General Public License v3.0
727 stars 50 forks source link

Reconsider the use of defsubst #226

Open phil-s opened 6 months ago

phil-s commented 6 months ago

centaur-tabs-functions.el in particular seems to have a large number of defsubst definitions. I suspect this is seen as a run-time optimisation (or a way to abstract out some of the code without incurring a run-time cost), but the use of defsubst is generally discouraged.

(elisp)Inline Functions warns:

Also, inline functions do not behave well with respect to debugging, tracing, and advising (*note Advising Functions::). Since ease of debugging and the flexibility of redefining functions are important features of Emacs, you should not make a function inline, even if it’s small, unless its speed is really crucial, and you’ve timed the code to verify that using ‘defun’ actually has performance problems.

In the absence of such performance analysis I think these should be defuns (and if such analysis has been done and it supports the usage of inline functions, consider documenting it).