At the time LaTeX2e was developed the number of command names was critical, and essentially the limit in PC implementations of the time determined how big LaTex2e could be and why packages like amsmath
, graphicx
, array
,... were kept as packages and not part of the format, there simply was not space.
Looking at the end of a log file of a recent document I made
24639 multiletter control sequences out of 65536+600000
so despite the format having preloaded expl3
and the document having loaded several packages there are still hundreds of thousands of slots left in the csname hash table.
For comparson the TeXBook shows the same log entry of a log of TeX while producing that book
1172 multiletter control sequences out of 2500
So my latex document used almost exactly ten times the maximum number of command names that were available in that early tex.
So basically now structure your code for maintenance don't worry about the memory consumption unless you are defining thousands of commands (as might happen if defining some new Unicode support for example).
If using pdftex or xetex (not luatex) the actual memory consumption does not depend on the macros defined, the relevant arrays are fixed size depending on the texmf.cnf configuration and the memory for the definitions is allocated whether or not you use it.
\mathrm
, not\operatorname
. The latter is slower.