Some string manipulation functions in subr-x have room to optimize. string-trim-left, string-trim-right -- use `substring' and `match-beginning/end' instead of `replace-match'. The formers have bytecodes and the latter not. string-trim -- call string-trim-left first would be cost effective. But, to change the code to trim both sides of the string at once might be better. string-remove-suffix -- change the last argument of substring will shorten the code. I change the string-trim defined using defun from defsubst, as its string literal is somewhat big (Actually I suspect most of other functions would also be better if defined by defun). Regards, Shigeru